Professional Documents
Culture Documents
Digital Image Processing: Assignment No. 2
Digital Image Processing: Assignment No. 2
2
DIGITAL IMAGE PROCESSING
Topic Covered :
1. Sampling & Quantization
2. Neighbouring of Pixels
3. Spatial Filtering
4. Introduction to Fourier Transformation
Submitted To:
Mr. Vijay Dheer
A.P(CSE/IT Deptt.)
Submitted by:
Gurjeet Singh
M. Tech. (3rd Semester)
Roll No. -100686582255
Fig. 1. Generating a digital image (a) Continuous image. (b) A scan line from A to B in the
continuous image. (c) Sampling & quantization. (d) Digital scan line.
The one- dimensional function shown in Fig. 1(b) is a plot of amplitude (gray level)
values of the continuous image along the line segment AB in Fig. 1(a).
To sample this function, we take equally spaced samples along line AB, as shown in
Fig.1(c). Location of each sample is given by a vertical tick mark in the bottom part of
the figure. The samples are shown as small white squares superimposed on the function.
The set of these discrete locations gives the sampled function. However, the values of the
samples still span (vertically) a continuous range of gray- level values. In order to form a
digital function, the gray- level values also must be converted (quantized) into discrete
quantities. The right side of Fig.1(c) shows the gray- level scale divided into eight
discrete levels, ranging from black to white. The vertical tick marks indicate the specific
value assigned to each of eight gray levels. The continuous gray levels are quantized
simply by assigning one of the eight discrete gray levels to each sample. The assignment
is made depending on the vertical proximity of a sample to a vertical tick mark. The
digital samples resulting from both sampling and quantization are shown in Fig. 1(d) and
Fig .2 (b).
Fig.
2 (a): Continuous image projected onto a sensor array.
2 (b): Result of image sampling and quantization.
sampling will produce a low resolution image in which there are a few pixels, each of which
represents of a relatively large part of the scene.
Neighbouring of pixel
Neighbors of a Pixel are 4-neighbors, diagonal-neighbors, 8-neighbors.
A pixel p at coordinates (x, y) has four horizontal and vertical neighbors whose
coordinates are given by:
(x+1, y), (x-1, y), (x, y+1), (x, y-1) .
This set of pixels, called the 4-neighbors of p, is denoted by N4 (p). Each pixel is a
unit distance from (x, y), and some of the neighbors of p lie outside the digital
image if (x, y) is on the border of the image.
The four diagonal neighbors of p have coordinates:
(x+1, y+1), (x+1, y-1), (x-1, y+1), (x-1, y-1) and are denoted by ND(p). These
points, together with the 4-neighbors, are called the 8-neighbors of p, denoted by
N8(p). As before, some of the points in ND(p) and N8(p) fall outside the image if (x,
y) is on the border of the image.
Neighbourhood Operations
Neighbourhood operations simply operate on a larger neighbourhood of pixels than point
operations. Neighbourhoods are mostly a rectangle around a central pixel. Any size rectangle
and any shape filter are possible.
g ( x, y )
w( s, t ) f ( x s, y t )
s at b
Filtering can be given in equation form as shown above. Notations are based on the image shown
to the left.
Smoothing Spatial Filters
One of the simplest spatial filtering operations we can perform is a smoothing operation. It is
Simply average all of the pixels in a neighbourhood around a central value. It is especially useful
in removing noise from images. It is also useful for highlighting gross detail.
/9
/9
/9
/9
/9
/9
/9
/9
/9
1/16
2/16
1/16
2/16
4/16
2/16
1/16
2/16
1/16
By smoothing the original image we get rid of lots of the finer detail which
leaves only the gross features for Thresholding.
Filtering is often used to remove noise from images. Sometimes a median filter works better than
an averaging filter.
and
and
The inverse of a transform is an operation that when performed on a transformed image produces
the original image. The inverse two-dimensional Fourier transform is given by
The two-dimensional M-by-N DFT and inverse M-by-N DFT relationships are given by