Experiment: Digital Image Processing: Image As A 2 D Signal
Experiment: Digital Image Processing: Image As A 2 D Signal
Experiment : Digital Image Processing
● Image as a 2D signal.
We can think of an image as a function,
f : R2 > R
f( x, y ) gives the intensity at position ( x, y )
Realistically, we expect the image only to be defined over a rectangle, with a finite range.
● What is an Digital Image?
Reflected light from scene sampled in space and represented as discrete elements called
pixels (pixel=picture+element). Hence pixel is a smallest distinguishable element of a
digital image.
● How a digital image is represented ? (Types of digital images)
○ Binary image/Black & White image:
Only two possible pixel values; 0=black, 1=white
○ Grayscale scale image:
'double' format in range 0 to 1
0.0=black, 1.0=white
'uint8' format in range 0 to 255 (for 8 bit image)
0=black, 255=white,
○ Color image:
R, G, B planes each satisfying grayscale pixel value criteria
● What is frequency in an image?
In the above figure, intuitively we can say t2t3 section contains higher frequency content
as compared to t1t2 as there are larger variations in t2t3 in smaller duration as compared
to t1t2. Similarly in spatial domain (i.e. in case of images) if pixel values are changing
suddenly in smaller spatial window then we can say there is high frequency content in
image. Opposite to that, if pixel values are varying slowly then it corresponds to lower
frequency content.
● What are image filters/masks/kernel/template/subimage?
Filters are classified as:
Lowpass (i.e., preserve low frequencies)
Highpass (i.e., preserve high frequencies)
Bandpass (i.e., preserve frequencies within a band)
Bandreject (i.e., reject frequencies within a band)
Spatial Filtering
1D moving avg
The concept of moving average filter is explained with the help of figure above.In case of 1D
signal, both signal and filter are vectors. In 2D case both signal and filter will be matrices.
Linear Spatial Filtering:
In general, linear filtering of an image f of size MxN with a filter mask of size mxn is given by
the expression:
Need to define:
(1) a neighborhood (or mask)
(2) an operation T
NonLinear Spatial filtering:
Nonlinear spatial filters (Orderstatistics filters) are those, whose response is based on ordering
(ranking) the pixels contained in the image area encompassed by the filter, and then replacing the
value of the center pixel with the value determined by the ranking result.
We will mainly focus on two types of spatial filters:
Smoothing (lowpass)
Sharpening (highpass)
NOTE: Sum of elements of mask should become one.
Smoothing Filters
● Box Average filter
● Gaussian filter
Two parameters, Standard deviation and size.
Size ~ 5 times of deviation
● Median Filtering
Corp region of neighborhood
Sort the values of the pixel in our region
In the MxN mask the median is MxN div 2 +1
Sharpening Filters
The principal objective of sharpening is to highlight fine detail in an image or to enhance detail
that has been blurred. Taking the derivative of an image results in sharpening the image.
The derivative of an image (i.e., 2D signal) can be computed using the gradient.
Gradient magnitude: provides information about edge strength.
Gradient direction: perpendicular to the direction of the edge.
● Prewitt Filter
● Sobel Filter
● Laplacian filter
Second derivative.
● Unsharp masking
Frequency domain Filtering:
● Read the description of following MATLAB commands using ‘help’: imread, fspecial,
imfilter, imshow, fft2, ifft2, figure.
● Basic understanding of filters (LPF HPF).
● Basic concepts of signals and systems.
Digital Image processing
NOTES :
1 Brief review of Topics in Part A and Part B has to be done before attending lab
2. Part A,B and C will be done in lab . Part D is assignment
3. For brief review one can refer Google along with the Study material provided
in separate file
PART A
AIM: understand the following basic concepts
1. What is an image
2. What are different types of images and how they are represented
3. What is frequency in an image
4. What is filter maskin case of 2D images
PART B
AIM: Apply following filter on the given grayscale image one by one with the
inbuilt matlab commands and understand the results
Basic commands: (can be Referred from Mathworks)
1. imread
2. Imshow
3. imfilter
4. fspecial
PART C
AIM: Apply 3x3 average filter over a given image without using inbuilt Matlab
commands
PART D (Assignment)
AIM: Apply filter over given noisy images and identify which filter perform
better without affecting the original image data much
Note: Images will be sent on the respective experiment day and need to submit
the result within 2 days