Expt 5-To Perform Edge Detection Using Various Masksssp

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Dr. D. Y.

Patil Group of Institutions’ Technical Campus


Dr. D. Y. PATIL SCHOOL OF ENGINEERING
Dr. D. Y. Patil Knowledge City, Charholi Bk., Via. Lohegaon, Pune – 412 105.
Department of Electronics and Telecommunication Engineering

EXPERIMENT NO.5

To perform edge detection using various masks.

Date of Performance
Date of Checking

Digital Image and Video Processing Lab BE E&TC (2015 course) Sem-I
Dr. D. Y. Patil Group of Institutions’ Technical Campus
Dr. D. Y. PATIL SCHOOL OF ENGINEERING
Dr. D. Y. Patil Knowledge City, Charholi Bk., Via. Lohegaon, Pune – 412 105.
Department of Electronics and Telecommunication Engineering

Title: To perform edge detection using various masks.

Aim: To perform edge detection operation on given image.

Software: SCILAB

Theory:
Edge detection
Edge points are found where the image intensity encounters a steep variation along a
specific direction ‘x’ (Fig.1). This intensity variation can be detected and quantified by
finding the local maxima of the first order derivative of the image intensity (the gradient:
f=f’) or by finding the zero crossings of the second order derivative of the image intensity
(the laplacian: 2f=f”).

Fig.1 Detection methods of the edge points (points were the image intensity suffers a steep
variation).

Computing the image gradient:


The gradient in an image point is a vector heading the direction of the intensity variation
around this point. Its module is proportional with the speed of this variation. If the edge
points are part of a contour the gradient will be perpendicular on the tangent to the
contour at that point. The gradient of a two variables digital function f is defined as:

( ) ( )
( ) [ ] [ ]
( ) ( )

Other approximations of the two components of the gradient can be computed through the
convolution of the image with the following kernels:

Digital Image and Video Processing Lab BE E&TC (2015 course) Sem-I
Dr. D. Y. Patil Group of Institutions’ Technical Campus
Dr. D. Y. PATIL SCHOOL OF ENGINEERING
Dr. D. Y. Patil Knowledge City, Charholi Bk., Via. Lohegaon, Pune – 412 105.
Department of Electronics and Telecommunication Engineering

Prewitt:

( ) [ ]

( ) [ ]

Sobel:

( ) [ ]

( ) [ ]

Roberts:

( ) [ ]

( ) [ ]

As a vector, the gradient can be quantified by a magnitude and a direction:

( ) √( ) ( ) )

( )

Digital Image and Video Processing Lab BE E&TC (2015 course) Sem-I
Dr. D. Y. Patil Group of Institutions’ Technical Campus
Dr. D. Y. PATIL SCHOOL OF ENGINEERING
Dr. D. Y. Patil Knowledge City, Charholi Bk., Via. Lohegaon, Pune – 412 105.
Department of Electronics and Telecommunication Engineering

Algorithm:
1) Start
2) Read the gray scale image i(x,y)
3) Obtain the size of the image (MXN).
4) Select an operator (Sobel, Prewitt or Robert) to perform edge detection.
5) Obtain the mask for corresponding operator (Sx and Sy).Select and store the size of
the mask in two variables.
6) Plot the original image and plot edge extraction image inbuilt function.
7) Initialize 4 nested for loops to2 outer for loops with respect to size of the image and
inner for loops with respect to masks. (Sx and Sy) size.
8) Convolve original image with Sx mask to get the X- gradient image.
9) Convolve original image with Sy mask to get the Y- gradient image.
10)Perform the following operation to get the resultant gradient.

√( ) ( )
11)Assign the value of S to the resultant image.
12)Display the edge detected image.
13)To see highlighted edge, keep the values of gray level having intensity 255 and
neglect others.
14)End.

Conclusion:

Digital Image and Video Processing Lab BE E&TC (2015 course) Sem-I

You might also like