Final Lab Report
Final Lab Report
Final Lab Report
Jahangirnagar University
4th year 1st semester Final Exam-2020
Submitted to:
Dr. Liton Jude Rozario
Professor
CSE, JU
Submitted by:
Name - Rumana Yasmin
Roll - 341
Exam Roll - 170464
Registration no. - 44097
Session: 2016-17
Working Principle:
Edge detection is a technique in image processing which is used to identify points
in a digital image with discontinuities. This technique detects sharp changes in
the image brightness. These points where the image brightness varies sharply are
called the edges (or boundaries) of the image.
Here, I have used Sobel operator, Prewitt operator and Roberts Cross Gradient
operator to detect edges.
Sobel Edge Detector operator: When using Sobel Edge Detection, the image is
processed in the X and Y directions separately first, and then combined together to
form a new image which represents the sum of the X and Y edges of the image.
Sobel convolutional kernels are:
Page 2 of 7
Prewitt Edge Detector operator:
When we apply this mask on the image it prominent vertical edges. It simply works
like as first order derivate and calculates the difference of pixel intensities in an edge
region. As the center column is of zero so it does not include the original values of
an image but rather it calculates the difference of right and left pixel values around
that edge. This increases the edge intensity and it becomes enhanced comparatively
to the original image.
Prewitt convolutional kernels are:
-1 0 1
Gx =
-1 0 1
-1 0 1
-1 -1 -1
Gy = 0 0 0
1 1 1
Page 3 of 7
Roberts convolutional kernels are:
Code in python:
import skimage.io as io
import skimage.filters as fl
import matplotlib.pyplot as plt
import skimage.exposure as ex
f = io.imread('D:\\Dataset\\7.1.05.tiff')
edge_s=fl.sobel(f)
edge_p=fl.prewitt(f)
edge_r=fl.roberts(f)
Page 4 of 7
plt.subplot(2,2,1)
plt.axis('off')
plt.title('Original image')
plt.imshow(ex.rescale_intensity(f,out_range=(0.0,1.0)),cmap='gray')
plt.subplot(2,2,2)
plt.axis('off')
plt.title('Image filtered with Sobel operator')
plt.imshow(ex.rescale_intensity(edge_s,out_range=(0.0,1.0)),cmap='gray')
plt.subplot(2,2,3)
plt.axis('off')
plt.title('Image filtered with Prewitt operator')
plt.imshow(ex.rescale_intensity(edge_p,out_range=(0.0,1.0)),cmap='gray')
plt.subplot(2,2,4)
plt.axis('off')
plt.title('Image filtered with Roberts operator')
plt.imshow(ex.rescale_intensity(edge_r,out_range=(0.0,1.0)),cmap='gray')
plt.show()
Page 5 of 7
Snapshot of input image:
Snapshot of output:
Page 6 of 7
Short Discussion:
The gradient differentiation operators like Prewitt, Sobel and Roberts share the same
principle of work. All of them use a separable kernel to calculate the gradient
approximation.
The main difference is that the Prewitt filter uses the same weight for all the pixels
that fall under the masks. Unlike Prewitt, Sobel operator give less weight to points
far from the center pixel. The major difference is that in Sobel operator the
coefficients of masks are not fixed and they can be adjusted according to our
requirement.
The Sobel operator is more sensitive to the diagonal edge is than to the horizontal
and vertical edges. On the contrary, Prewitt operator is more sensitive to horizontal
and vertical edges. Whereas, the results of Roberts cross gradient operation will
highlight changes in intensity in a diagonal direction.
Page 7 of 7