You are on page 1of 10

Lab Report 8 for CE671 Practical

Full Name- Ashish Hanumant Chavan


Roll Number- 19103015
Department- Civil Engineering
Email: ashishchavan97@gmail.com

03/10/2019

1 Introduction
In the given lab we would work on high pass and low pass filtering by choosing appropriate kernel's in MATLAB.
The given lab work will give us better understanding regarding the effect of an filter on the image. We would also
be able to understand the predefined functions like "fspecial" and "imfilter" for edge detection, image smoothing
etc.
Applications of image filtering using high pass and low pass filters would be better understood by carrying out
the given lab work.

2 Methodology
In the given methodology initially I have used the FCC image of kanpur area to show Image Smoothing, edge
detection. Image of IIT Kanpur is used for Edge Strength and Edge Gradient image.

2.0.1 Image Smoothing


• The kernel for carrying out averaging is constructed and applied to the given FCC image and also for the
Histogram Equalized FCC of kanpur area.
• Here I have not linearly stretched my image as when the histogram of the image is observed we can see
that the Digital Number values are already spread over the range of 0-255.
• The difference in the smoothness can easily be seen after zooming in the image, the result can be seen as
below-

Figure 1: Details in Image Smoothing

1
Lab Report 8 CE671A

2.1 Structure Element for Detection of an astronomical body


• For this excersie I have downloaded a satellite image consisting of some stars.
• After applying different methods available in "fspecial", like prewitt, laplacian, log I have considered using
a sobel kernel and a Transpose sobel kernel.
• After applying both the kernels to the smoothed astronomical image and then adding the images we get
the following result.

Figure 2: Image filtering on a astronomical image

2.2 Highlighting the boundaries of Peppers image in MATLAB


• The best way to highlight the boundary would be using laplacian method.
• Hence I have used inbuilt MATLAB command of "fspecial" and method as "Laplacian" for highlighting the
boundaries of the peppers image.
• The output image is as follows.

Figure 3: Highlighting boundaries of Peppers Image

2.3 Details of imfilter function of MATLAB


• imfilter function is used to apply the predefined kernel to an image.
• The imfilter function can be written as "arrayA = imfilter(A,h)"; where "A" is the Image Array and "h" is
the kernel to be applied for image "A".
• Changing the order of paramter would mean applying kernel "A" to an image "h".
• As the Image array would be smaller than the kernel in this case we get an error in MATLAB when we
reverse the order of the parameters in imfilter.
2
Lab Report 8 CE671A

2.4 Applying different filters on the image and delineating the results
2.4.1 Building 2 element filter
• Horizontal Low Pass Filter

• High Pass Filter

• Vertical Low Pass Filter

• Vertical High Pass Filter

3
Lab Report 8 CE671A

Use of different Filters


Filter Input Image Output Image Description

Horizontal
Low pass • We can observe
Filter smoothness in the
image.
• By applying hori-
zontal low pass filter
smoothness along
vertical direction
can be observed.

Horizontal
High Pass • The horizontal high
Filter pass filter defines
the vertical edges in
the image.

• We can observe that


the river being in
horizontal direction
is not defined prop-
erly.

4
Lab Report 8 CE671A

Use of different Filters


Filter Input Image Output Image Description

Vertical
Low Pass • We can observe
Filter smoothness in the
image.
• By applying verti-
cal low pass filter
smoothness along
horizontal direction
can be observed.

Vertical
High Pass • The vertical high
Filter pass filter defines
the horizontal edges
in the image.

• We can observe that


the river being in
horizontal direction
is properly defined.

2.5 Using different options available under fspecial

5
Lab Report 8 CE671A

Use of different options under fspecial


Filter Input Image Output Image Description

Disk
• We can observe
smoothness in the
image.
• Circular Averaging
takes place by using
this option.

• The smoothing
intensity is higher
than normal average
filter.

Gaussian
• This being a low
pass filter we ob-
serve smoothness in
the image.
• The intensity of the
smoothness can be
defined by specify-
ing the standard de-
viation value.
• More the stan-
dard deviation
more smoothness is
observed.

laplacian
• This being a high
pass filter, it is used
for edge detection.
• Unlike horizontal
and vertical high
pass filter, a sin-
gle laplacian filter
emphasises all the
6 edges in the image.
Lab Report 8 CE671A

Use of different options under fspecial


Filter Input Image Output Image Description

Log
• This filter is the
laplacian of gaussian
filter.
• Hence the image is
smoothned with the
help of gaussian fil-
ter and then edge
detection is carried
out using laplacian
filter.

Motion
• This filter is used to
stabilize the moving
image or the image
in motion.
• Here as the image
is stable image use
of motion filter, ap-
parently makes it
look like image is
captured through a
moving platform.

Prewitt
• This is a high pass
filter usedd for hor-
izontal edge detec-
tion.
• We can see that the
horizontal edges in
the image are em-
phasised over verti-
cal edges.

8
Lab Report 8 CE671A

2.6 Generation of edge strength and edge direction image.


• By using the edge strength formula we assign values to the pixel depending upon the intensity of the edge.

• That is for well defined edges higher DN are assigned.


• The edge strength image for IIT Kanpur campus can be observed as-

Figure 4: Edge Strength Image for IIT Kanpur Campus

• In edge gradient image we assign values according to the direction of the image.

• The edge gradient image for IIT Kanpur campus look like-

Figure 5: Edge Direction image of IIT Kanpur Campus

2.7 Using inbuilt MATLAB functions for Edge Detection, Edge Strength and Edge
Gradient
• In MATLAB we have inbuilt functions for edge detection also different methods of edge detection can be
adopted by MATLAB.
• For the following example I have consider Canny Edge detection, it can also be noted that sensitivity of
the edge detection can be altered.

9
Lab Report 8 CE671A

Figure 6: Canny Edge Detection for IIT kanpur Campus Image

• We can find out the Gradient Magnitude image and Gradient Direction image using in built "imgradient"
and "imgradientxy".

• The Gradient Magnitude image for IIT kanpur campus usinng imgradient command-

Figure 7: Gradient Magnitude image using imgradient and imgradientxy

• The Gradient Direction image for IIT kanpur campus usinng imgradient command-

Figure 8: Gradient Direction image using imgradient and imgradientxy

10
Lab Report 8 CE671A

3 Discussion
• There are number of image filtering options some of which are predefined in MATLAB, the effect of every
image filter on the image is different.
• Depending upon the necessity we decide which image filter to be used or how many filters and in which
order should they be used.
• Image filters like "sobel", "prewitt" are high pass filters and are used for horizontal edge detection.
• Image filters like "laplacian" is also a high pass filter but it can be usedd for both horizontal and vertical
edge enhancement.

• The low pass filters like "average" or "gaussian" is used to reduce the noise from the image.
• The gradient magnitude image defines the intensity of the edge present in the image.
• The gradient direction image defines the direction of the edge present in the image.

4 Conclusion
• There are different types of image filters and for which different kernel operators are needed to be defined.
• Depending upon the input data and the output requirement the selection of image filter or filters is done.
• High pass filters are used for edge enhancement purposes and before applying any high pass filter we should
get rid of any noise present in the image.

• Low pass filters are used for smoothing the image hence reducing the noise of the image.

References
[1] https://in.mathworks.com
[2] https://blogs.mathworks.com
[3] https://tex.stackexchange.com
[4] https://en.wikipedia.org
[5] https://www.quora.com
[6] https://www.tutorialspoint.com
[7] https://theailearner.com

11

You might also like