Digital Image Processing and Applications
Digital Image Processing and Applications
Digital Image Processing and Applications
APPLICATIONS
2
WHAT IS A GRAY SCALE?
4
5
6
REPRESENTING DIGITAL IMAGE
7
REPRESENTATION OF DIGITAL IMAGE
8
STORAGE BITS FOR VARIOUS VALUES OF N AND K
9
SPATIAL AND INTENSITY RESOLUTION
Spatial resolution is a measure of the smallest
discernible details in an image.
10
ZOOMING AN IMAGE
Requires two steps:
1) The creation of new pixel location and
2) The assignment of gray levels to those new locations.
Two methods for gray-level assignment to a pixel:
1) The nearest neighbor interpolation and
2) The bilinear interpolation
3) The bicubic interpolation
11
ZOOMING OF AN IMAGE
12
HOW TO ZOOM THE INPUT IMAGE USING MATLAB?
>>i=imread('circuit.tif');
>> [r,c]=size(i);
>> j=imresize(i,[10*r , 10*c],’nearest’);
>>k=imresize(i, [10*r , 10*c], ‘bilinear’);
>>figure(1),imshow(i);
>> figure(2),imshow(j);
>>Figure(3),imshow(k);
Figure(1) is shown here , which is an input image.
Figure(2) is the zoom of an input image using nearest neighbor
interpolation.
Figure(3) is the zoom of an input image using bilinear
interpolation
13
HOW TO ZOOM THE INPUT IMAGE USING MATLAB? CONT..
14
PIXEL REPLICATION: SPECIAL CASE OF NEAREST NEIGHBOR
INTERPOLATION
BILINEAR AND BICUBIC INTERPOLATION
Let (x,y) denote the coordinates of the location to
which we want to assign an intensity value and let
v(x,y) denote that intensity value. For bilinear
interpolation, the assigned value is obtained using the
equation ,
V(x,y)= ax + by + cxy + d
Bicubic interpolation involves the sixteen nearest
neighbors of a point. The intensity value assigned to
point (x,y) is obtained using equation,
3 3
V(x,y) = Ʃ Ʃ aij x i y j
i=0 j=0 16
COMPARISON BETWEEN NEAREST
NEIGHBOR AND BILINEAR INTERPOLATION
17
BILINEAR INTERPOLATION
Note that these coordinate values will always lie between 0 and 499. The four
nearest neighbors of this grid point are: A(221, 409), A(221, 410), A(222,
409), and A(222, 410). (These coordinate values can be found by using the
floor and ceil functions.)
The bilinear interpolation equation is:
v ( x , y)=a x+b y +c x y+d
BILINEAR INTERPOLATION
We obtain four equations by evaluating this
equation at the four nearest neighbors. In matrix
form we would have:
BILINEAR INTERPOLATION
Assume the four nearest neighbors have intensity values:
A(221, 409) = 121, A(221, 410) = 124,
A(222, 409) = 118, and A(222, 410) = 110.
Solving the matrix equation above with these values
yields: [a b c d ]=[4496 2434 −11 −994720] .
Using these four coordinates in the bilinear interpolation
equation above gives v(221.185, 409.726) = 121.15 We
would then assign this value to B(332, 615) (after
appropriate rounding). This procedure would need to be
repeated for each element of B.
BICUBIC INTERPOLATION
In mathematics, bicubic interpolation is an
extension of cubic interpolation for interpolating
data points on a two dimensional regular grid.
The interpolated surface is smoother than
corresponding surfaces obtained by bilinear
interpolation or nearest-neighbor interpolation.
Bicubic interpolation can be accomplished using
either Lagrange polynomials, cubic splines or
cubic convolution algorithm.
BICUBIC INTERPOLATION(CONT..)
In contrast to bilinear interpolation, which only
takes 4 pixels (2×2) into account, bicubic
interpolation considers 16 pixels (4×4).
Images resampled with bicubic interpolation are
smoother and have fewer interpolation artifacts.
BICUBIC INTERPOLATION
BICUBIC INTERPOLATION
BICUBIC INTERPOLATION
SHRINKING AN IMAGE
26
SHRINKING OF AN INPUT IMAGE
27
SAME SIZE, DIFFERENT PIXEL SIZES
VARYING GRAY LEVEL RESOLUTION
SIZE, QUANTIZATION LEVELS AND DETAILS
Isopreference curves
BASIC RELATIONSHIP BETWEEN PIXELS
Neighborhood
Adjacency
Connectivity
Paths
Regions and boundaries
NEIGHBORHOOD OF A PIXEL
8-neighbors of a pixel p
are its vertical, horizontal
and 4 diagonal neighbors
denoted by ND(p).
NEIGHBORS OF A PIXEL( CONT..)
N4 :- 4-neighbors.
ND :- diagonal neighbors.
N8- 8- neighbors (N4UND)
ADJACENCY
Two pixels are connected if they are neighbors
and their gray levels satisfied some specified
criterion of similarity.
For example, in a binary image two pixels are
connected if they are 4-neighbors and have same
value(0/1).
ADJACENCY (CONT..)
Let V be set of gray level values used to define adjacency.
4-adjacency: Two pixels p and q with values from V are
4-adjacent if q is in the set N4(p).
8-adjacency: Two pixels p and q with values from V are
8-adjacent if q is in the set N8(p).
m-adjacency: Two pixels p and q with values from V are
m-adjacent if
q is in N4(p).
q is in ND(p) and the set [N4(p) ∩ N4(q)] is empty.
CONNECTIVITY
To determine whether the pixels
are adjacent in some sense.
Two pixels p and q are :
a. 4-connected: if q is in the set
N4(p).
b. 8-connected: if q is in the set
N8(p).
c. m-connected :
if q is in N4(p) or
q is in ND(p) and the set
[N4(p) ∩ N4(q)] is empty.
ADJACENCY/ CONNECTIVITY
ADJACENCY/ CONNECTIVITY
Pixel p is adjacent to
pixel q ,if they are
connected.
Two image subsets S1
and S2 are adjacent if
some pixel in S1 is
adjacent to some pixel in
S2.
PATHS AND PATH LENGTHS
A path from pixel p with co-ordinates (x,y) to
pixel q with co-ordinates (s,t) is a sequence of
distinct pixels with co-ordinates
(x0,y0), (x1,y1), (x2,y2),……….(xn,yn)
Where (x0,y0) = (x,y) and (xn,yn)=(s,t).
(xi,yi) is adjacent to (xi-1,yi-1), 1<i<n
Here n is the length of the path.
We can define 4-,8- and m- paths based on type
of adjacency used.
CONNECTED COMPONENTS
If p and q are pixels of an image subset S then p
is connected to q in S if there is a path from p to q
consisting entirely of pixels in S.
For every pixel p in S , the set of pixels in S that
are connected to p is called as connected
components of S.
If S has only one connected component then S is
called connected set.
REGIONS AND BOUNDARIES
A subset R of pixels in an image is called a
Region of the image if R is the connected set.
The boundary of the region R is the set of pixels
in the region that have one or more neighbors that
are not in R.
DISTANCE MEASUREMENT
For pixels p , q and z ,with co-ordinates
(x,y),(s,t) and (v,w),resp. D is a distance
function if
1. D(p,q) >=0 : (D(p,q) = 0 if p=q),
2. D(p,q) = D(q,p) and
3. D(p,z) <=D(p,q) + D(q,z)
The Euclidean distance between p and q is
defined as
De(p,q) = [ (x-s)2 +(y-t)2 ]1/2
DIFFERENT DISTANCE MEASURES
Euclidean Distance:
De(p,q) = [(x-s)2 + (y-t)2]
City-block Distance:
D4(p,q) = |x-s| + |y-t|
Chess-board Distance:
D8(p,q)= max(|x-s| , |y-t|)
DISTANCE MEASUREMENT EXAMPLE
MATHEMATICAL
TOOLS USED IN
DIGITAL IMAGE
PROCESSING