Lab 7 PDF
Lab 7 PDF
Lab 7 PDF
Lab Objective:
The objective of this lab is to apply differential spatial filters and Canny edge detector on images
to detect edges.
Lab Description:
Different spatial filters allow us to enhance the details in an image as per our requirement. In
order to find out the boundary or edges of objects in an image, Differential filters come in handy.
One of the differential filter is Sobel filter
Horizontal Sobel filter is used to find out the edges along x-axis as it calculates the derivative of
an image in x direction.
-1 0 1
-2 0 2
-1 0 1
While Vertical Sobel filter is used to find out the edges along y-axis.
-1 -2 -1
0 0 0
1 2 1
The edges obtained from applying both this filters can then be added to obtain all the edges in an
image.
The result of either sobel filter ranges from -1020 to +1020. Where 0 stands for no change while
-1020 and 1020 suggest maximum change from light to dark and dark to light respectively, but
we are interested in change not light to dark or dark to light change so in order to achieve that we
can take absolute values only.
Digital Image Processing Lab Manual
Canny Edge Detection: is a popular edge detection algorithm. Steps are as follows.
Lab Task:
Now find phase of the image and show the lines that are on 45 and 90 degrees.
Now show the lines that are on 45 and 90 degrees and have top 30% magnitude.
2: Apply canny edge detector to find edges in the imag.
Home Task
1. Apply Hough transform on the edge detected image using cv2.HoughLines ().