0% found this document useful (0 votes)
69 views34 pages

Lectures 6-7-8: Edge Detection: Dr. V Masilamani

This document discusses edge detection in images. It covers what edges are, why they are important, and how they can be detected using first and second derivative operators. Specifically, it explains how first derivative filters like Robert, Prewitt and Sobel operate by approximating the gradient to detect edges, and compares their performance to second derivative operators.

Uploaded by

Prateek Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views34 pages

Lectures 6-7-8: Edge Detection: Dr. V Masilamani

This document discusses edge detection in images. It covers what edges are, why they are important, and how they can be detected using first and second derivative operators. Specifically, it explains how first derivative filters like Robert, Prewitt and Sobel operate by approximating the gradient to detect edges, and compares their performance to second derivative operators.

Uploaded by

Prateek Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Lectures 6- 7-8: Edge Detection

Dr. V Masilamani
[email protected]
Department of Computer Science and Engineering
IIITDM Kancheepuram
Chennai-127

Computer Vision Lectures 6-7-8: Edge Detection 1 / 34


Overview

1 What is edge?

2 Why to detect edge?

3 Which features of object cause edges in its image

4 How to detect edge?


Edge detection using first derivative operators
Edge detection using second derivative operators

5 Pre-processing before applying edge detection operator

6 Some applications of edge detection

7 Acknowledgements

Computer Vision Lectures 6-7-8: Edge Detection 2 / 34


What is edge

Computer Vision Lectures 6-7-8: Edge Detection 3 / 34


What is edge (cont.)

Computer Vision Lectures 6-7-8: Edge Detection 4 / 34


Why to detect edge?

I Edge in image provides structural information of object in the scene

Computer Vision Lectures 6-7-8: Edge Detection 5 / 34


Why to detect edge? (cont.)

Computer Vision Lectures 6-7-8: Edge Detection 6 / 34


Why to detect edge? (cont.)

I Structural information of
object is more important than
the other information such as
colour

Computer Vision Lectures 6-7-8: Edge Detection 7 / 34


Which features of object cause edges in its image

I Discontinuity in surface
normal of the object
I Discontinuity in depth
I Discontinuity in colour of the
surface of the object
I Discontinuity in light intensity

Computer Vision Lectures 6-7-8: Edge Detection 8 / 34


Models of edge

I Edge Point: If intensity profile


changes at a point p
significantly, then p is called
as edge point
I Edge Map: Set of edge points
is called as edge map

Computer Vision Lectures 6-7-8: Edge Detection 9 / 34


Edge detection using first derivative operators

I Let f (x) be a function


I
f 0 (x) = lim (f (x + h) − f (x))/h
h→0

I Discrete Approximation 1: f 0 (x) = f (x + 1) − f (x) (Sub h=1)


• f 0 (x) = Cov (f (x), w (x)), where w = (1, −1) —(1)
I f = (5, 5, 5, 5, 5, 10, 10, 10, 10, 10)
I f 0 = 0, 0, 0, 0, 5, 0, 0, 0, 0, 0
• An Approximation to (1), f 0 (x) = Cov (f (x), w (x), where
w = (1, 0, −1) ——(2)
I f = (5, 5, 5, 5, 5, 10, 10, 10, 10, 10)
I f 0 = 0, 0, 0, 0, 5, 5, 0, 0, 0, 0

I Discrete Approximation 2: f 0 (x) = f (x) − f (x − 1) (Sub h=-1)

Computer Vision Lectures 6-7-8: Edge Detection 10 / 34


Edge detection using first derivative operators (cont.)

Computer Vision Lectures 6-7-8: Edge Detection 11 / 34


Edge detection using first derivative operators (cont.)
I How to detect edge point in 1D signal f?
if (f 0 (x) > T0 ) then x is an edge point
First Derivative Filters for Images
I Robert
Along X direction
 
1
−1
Along Y direction

1 −1
Along diagonal direction
 
1 0
0 −1
Along anti diagonal direction

Computer Vision Lectures 6-7-8: Edge Detection 12 / 34


Edge detection using first derivative operators (cont.)

 
0 1
−1 0

I How to detect edge point in 2D signal f?


• If |∇(f (x, y ))| > T0 , then (x, y ) is an edge pixel

Computer Vision Lectures 6-7-8: Edge Detection 13 / 34


Edge detection using first derivative operators (cont.)

Issues with Robert Filters


I Not center aligned
I Noise pixels are also detected as edge pixel
Approximating to make it center aligned, and remove noise before
taking derivatives
I Instead of  
1
−1
, consider  
1
 0 
−1

I Remove noise using sum filter before applying derivatives

Computer Vision Lectures 6-7-8: Edge Detection 14 / 34


Edge detection using first derivative operators (cont.)

I Prewitt filter along X -dir (to detect horizontal edge) is defined as


 
1 1 1
Px =  0 0 0 
−1 −1 −1

Prewitt in X - dir filter can be seen as convolution of smoothing and


differentiating operator as follows.
 
1 
 0 ∗ 1 1 1
−1

Computer Vision Lectures 6-7-8: Edge Detection 15 / 34


Edge detection using first derivative operators (cont.)

I Similarly along Y dir (to detect vertical edge), the Prewit filter will
be
 
1 0 −1
Py =  1 0 −1 
1 0 −1

Prewitt in Y -dir filter can be seen as convolution of smoothing and


differentiating operator as follows.
 
 1
1 0 −1 ∗  1 
1

I Horizontal Edge Detection: fx = Eh (f ) = f ∗ Px


I Vertical Edge Detection: fy = Ev (f ) = f ∗ Py

Computer Vision Lectures 6-7-8: Edge Detection 16 / 34


Edge detection using first derivative operators (cont.)

Edge detection using gradient:

Computer Vision Lectures 6-7-8: Edge Detection 17 / 34


Edge detection using first derivative operators (cont.)

Edge detection using gradient:

I Edge Detection:
if( |∇(f (x, y ))| > T ) then E (x, y ) = 1
else E (x, y ) = 0

Computer Vision Lectures 6-7-8: Edge Detection 18 / 34


Edge detection using first derivative operators (cont.)

Edge detection using gradient:

Computer Vision Lectures 6-7-8: Edge Detection 19 / 34


Edge detection using first derivative operators (cont.)
• Sobel filter along X -dir (to detect horizontal edge) is defined as
 
1 2 1
Sx =  0 0 0 
−1 −2 −1

Sobel in X - dir filter can be seen as convolution of smoothing and


differentiating operator as follows.
 
1 
 0 ∗ 1 2 1
−1

• Similarly along Y dir (to detect vertical edge), the Sobel filter will be
 
1 0 −1
Sy =  2 0 −2 
1 0 −1

Sobel in Y -dir filter can be seen as convolution of smoothing and


differentiating operator as follows.
Computer Vision Lectures 6-7-8: Edge Detection 20 / 34
Edge detection using first derivative operators (cont.)

 
 1
1 0 −1 ∗ 2 
1

• Horizontal Edge Detection: fx = Eh (f ) = f ∗ Sx


• Vertical Edge Detection: fy = Ev (f ) = f ∗ Sy
• Edge Detection Using gradient:

if( |∇(f (x, y ))| > T ) then E (x, y ) = 1


else E (x, y ) = 0

Computer Vision Lectures 6-7-8: Edge Detection 21 / 34


Edge detection using first derivative operators (cont.)

Edge detection using gradient:

Computer Vision Lectures 6-7-8: Edge Detection 22 / 34


Edge detection using first derivative operators (cont.)

Summary of edge detection using gradient:

Computer Vision Lectures 6-7-8: Edge Detection 23 / 34


Edge detection using second derivative operators

What are the issues with first


derivative based filters

I Even when intensity profile is


slowly varying at a point p, p
may be be declared as edge
point

I Localization of edge point is


not effective

Computer Vision Lectures 6-7-8: Edge Detection 24 / 34


Edge detection using second derivative operators
(cont.)
Laplacian Filter Design

Computer Vision Lectures 6-7-8: Edge Detection 25 / 34


Edge detection using second derivative operators
(cont.)

Properties of Lapacian filter


I The output of the filter is 0, when applied on homogeneous region
I The magnitude of output of the filter is high, when applied on edges
I Zero Crossing(+ve/-ve followed by -ve/+ve) indicates the presence
of edges
I Zero Crossing can be used to located the edge point effectively

Computer Vision Lectures 6-7-8: Edge Detection 26 / 34


Edge detection using second derivative operators
(cont.)

Other variants of Laplacian Filter -satisfying above


properties

Computer Vision Lectures 6-7-8: Edge Detection 27 / 34


Edge detection using second derivative operators
(cont.)

Computer Vision Lectures 6-7-8: Edge Detection 28 / 34


Edge detection using second derivative operators
(cont.)

Smoothing followed by Laplacian Filter Design


-Laplacian of Gaussian Filter(LOG)

Computer Vision Lectures 6-7-8: Edge Detection 29 / 34


Pre-processing before applying edge detection operator

I To obtain accurate edges, do pre-processing such as


• Noise removal
• Contrast enhancement
• Sharpen the image

Computer Vision Lectures 6-7-8: Edge Detection 30 / 34


Pre-processing before applying edge detection operator
(cont.)

Computer Vision Lectures 6-7-8: Edge Detection 31 / 34


Some applications of edge detection

I Object detection
I Measure computation

Computer Vision Lectures 6-7-8: Edge Detection 32 / 34


Acknowledgements

I Images are downloaded from internet sources

Computer Vision Lectures 6-7-8: Edge Detection 33 / 34


Thank You! :)

Computer Vision Lectures 6-7-8: Edge Detection 34 / 34

You might also like