Vous êtes sur la page 1sur 44

EDGE DETECTION

Presentation by Sarbjeet Singh









(National Institute of Technical Teachers Training and research) Chandigarh

10/29/2014 ECE - Sarbjeet Singh 2
CONTENTS
Introduction
Types of Edges
Steps in Edge Detection
Methods of Edge Detection
First Order Derivative Methods
First Order Derivative Methods - Summary
Second Order Derivative Methods
Second Order Derivative Methods - Summary
Optimal Edge Detectors
Canny Edge Detection
Edge Detector Performance
Application areas

10/29/2014 ECE - Sarbjeet Singh 3
INTRODUCTION
Edge - Area of significant
change in the image
intensity / contrast
Edge Detection
Locating areas with
strong intensity contrasts
Use of Edge Detection
Extracting information
about the image. E.g.
location of objects
present in the image,
their shape, size, image
sharpening and
enhancement

10/29/2014 ECE - Sarbjeet Singh 4
TYPES OF EDGES
Variation of
Intensity / Gray
Level
Step Edge
Ramp Edge
Line Edge
Roof Edge



10/29/2014 ECE - Sarbjeet Singh 5
Steps in Edge Detection
Filtering Filter image to improve
performance of the Edge Detector wrt noise
Enhancement Emphasize pixels having
significant change in local intensity
Detection Identify edges - thresholding
Localization Locate the edge accurately,
estimate edge orientation
10/29/2014 ECE - Sarbjeet Singh 6
Noisy Image
Example of Noisy Image
10/29/2014 ECE - Sarbjeet Singh 7
METHODS OF EDGE DETECTION
First Order Derivative / Gradient Methods
Roberts Operator
Sobel Operator
Prewitt Operator
Second Order Derivative
Laplacian
Laplacian of Gaussian
Difference of Gaussian
Optimal Edge Detection
Canny Edge Detection
First Derivative
At the point of greatest
slope, the first
derivative has maximum
value
E.g. For a Continuous 1-
dimensional function f(t)

10/29/2014 ECE - Sarbjeet Singh 8
10/29/2014 ECE - Sarbjeet Singh 9
Gradient
For a continuous two dimensional
function Gradient is defined as

(
(
(
(

c
c
c
c
=
(

=
y
f
x
f
Gy
Gx
y x f G )] , ( [
Gy Gx Gy Gx G + ~ + =
2 2
|
.
|

\
|
=

Gx
Gy
1
tan u
10/29/2014 ECE - Sarbjeet Singh 10
Gradient
Approximation of Gradient for a
discrete two dimensional function
Convolution Mask
Gx=



Gy =



Differences are computed at the
interpolated points [i, j+1/2] and
[i+1/2, j]
-1 1
-1 1
] , 1 [ ] , [
] , [ ] 1 , [
j i f j i f Gy
j i f j i f Gx
+ ~
+ ~
1 1
-1 -1
-1 1
1
-1
10/29/2014 ECE - Sarbjeet Singh 11
Gradient Methods Roberts
Operator
Provides an approximation to the gradient


Convolution Mask
Gx=


Gy =





Differences are computed at the interpolated points [i+1/2,
j+1/2] and not [i, j]

1 0
0 -1
0 -1
1 0
) 1 , ( ) , 1 ( ) 1 , 1 ( ) , ( )] , ( [ + + + + + = + = j i f j i f j i f j i f Gy Gx j i f G
10/29/2014 ECE - Sarbjeet Singh 12
Roberts Operator - Example
The output image
has been scaled by
a factor of 5
Spurious dots
indicate that the
operator is
susceptible to
noise
10/29/2014 ECE - Sarbjeet Singh 13
Gradient Methods Sobel Operator
The 3X3 convolution mask smoothes the image by
some amount , hence it is less susceptible to noise. But
it produces thicker edges. So edge localization is poor
Convolution Mask


Gx = Gy=




The differences are calculated at the center pixel of the
mask.
-1 0 1
-2 0 2
-1 0 1
1 2 1
0 0 0
-1 -2 -1
10/29/2014 ECE - Sarbjeet Singh 14
Sobel Operator - Example
Compare the output of
the Sobel Operator with
that of the Roberts
Operator:
The spurious edges are
still present but they
are relatively less
intense compared to
genuine lines
Roberts operator has
missed a few edges
Sobel operator detects
thicker edges
Will become more clear
with the final demo
Outputs of Sobel (top) and Roberts operator
10/29/2014 ECE - Sarbjeet Singh 15
Gradient Methods Prewitt
Operator
It is similar to the Sobel operator but uses slightly
different masks
Convolution Mask
Px =



Py =
-1 0 1
-1 0 1
-1 0 1
1 1 1
0 0 0
-1 -1 -1
10/29/2014 ECE - Sarbjeet Singh 16
First Order Derivative Methods -
Summary
Noise simple edge detectors are affected
by noise filters can be used to reduce
noise
Edge Thickness Edge is several pixels
wide for Sobel operator edge is not
localized properly
Roberts operator is very sensitive to noise
Sobel operator goes for averaging and
emphasizes on the pixel closer to the
center of the mask. It is less affected by
noise and is one of the most popular Edge
Detectors.
10/29/2014 ECE - Sarbjeet Singh 17
Second Order Derivative Methods
Zero crossing of the second derivative
of a function indicates the presence of
a maxima
10/29/2014 ECE - Sarbjeet Singh 18
Second Order Derivative Methods -
Laplacian
Defined as

Mask



Very susceptible to noise, filtering
required, use Laplacian of Gaussian
0 1 0
1 -4 1
0 1 0
10/29/2014 ECE - Sarbjeet Singh 19
Second Order Derivative Methods -
Laplacian of Gaussian
Also called Marr-Hildreth Edge
Detector
Steps
Smooth the image using Gaussian filter
Enhance the edges using Laplacian
operator
Zero crossings denote the edge location
Use linear interpolation to determine the
sub-pixel location of the edge
10/29/2014 ECE - Sarbjeet Singh 20
Laplacian of Gaussian contd.
Defined as



Greater the value of o, broader is the
Gaussian filter, more is the smoothing
Too much smoothing may make the
detection of edges difficult

10/29/2014 ECE - Sarbjeet Singh 21
Laplacian of Gaussian - contd.
Also called the Mexican Hat operator


10/29/2014 ECE - Sarbjeet Singh 22
Laplacian of Gaussian contd.
Mask







Discrete approximation to LoG function with Gaussian = 1.4
10/29/2014 ECE - Sarbjeet Singh 23
Second Order Derivative Methods -
Difference of Gaussian - DoG
LoG requires large computation time
for a large edge detector mask
To reduce computational
requirements, approximate the LoG
by the difference of two LoG the
DoG
2
2
)
2
2 2
(
2
1
)
2
2 2
(
2 2
) , (
2
2
2
1
to to
to to
y x y x
e e
y x DoG
+

=
10/29/2014 ECE - Sarbjeet Singh 24
Difference of Gaussian contd.
Advantage of DoG
Close approximation of LoG
Less computation effort
Width of edge can be adjusted by
changing o1 and o2

10/29/2014 ECE - Sarbjeet Singh 25
Second Order Derivative Methods -
Summary
Second Order Derivative methods
especially Laplacian, are very
sensitive to noise
Probability of false and missing edges
remain
Localization is better than Gradient
Operators
10/29/2014 ECE - Sarbjeet Singh 26
Optimal Edge Detector
Optimal edge detector depending on
Low error rate edges should not be missed
and there must not be spurious responses
Localization distance between points marked
by the detector and the actual center of the
edge should be minimum
Response Only one response to a single edge
One dimensional formulation
Assume that 2D images have constant cross
section in some direction

10/29/2014 ECE - Sarbjeet Singh 27
First Criterion: Edge Detection
Response of filter to the edge:

RMS response of filter to noise :

First criterion: output Signal to Noise
Ratio
10/29/2014 ECE - Sarbjeet Singh 28
Second Criterion: Edge Localization
A measure that increases as the
localization increases is needed
Reciprocal of RMS distance of the
marked edge from center of true edge
is taken as the measure of localization
Localization is defined as:

10/29/2014 ECE - Sarbjeet Singh 29
Third Criterion Elimination of
multiple responses
In presence of noise several maxima are
detected it is difficult to separate noise
from edge
We try to obtain an expression for the
distance between adjacent noise peaks
The mean distance between the adjacent
maxima in the output is twice the distance
between the adjacent zero crossings in the
derivative of output operator


10/29/2014 ECE - Sarbjeet Singh 30
Noise estimation
Important to estimate the amount of noise
in the image to set thresholds
Noise component can be efficiently isolated
using Weiner Filtering requires the
knowledge of the autocorrelation of
individual components and their cross-
correlation
Noise strength is estimated by Global
Histogram Estimation

10/29/2014 ECE - Sarbjeet Singh 31
Thresholding
Broken edges due to fluctuation of
operator output above and below the
threshold results in Streaking
Use double thresholding to eliminate
streaking
10/29/2014 ECE - Sarbjeet Singh 32
Two Dimensional Edge Detection
In two dimensions edge has both position
and direction
A 2-D mask is created by convolving a
linear edge detection function aligned
normal to the edge direction with a
projection function parallel the edge
direction
Projection function is Gaussian with same
deviation as the detection function
The image is convolved with a symmetric
2-D Gaussian and then differentiated
normal to the edge direction
10/29/2014 ECE - Sarbjeet Singh 33
Implementation of Canny Edge
Detector
Step 1
Noise is filtered out usually a Gaussian filter
is used
Width is chosen carefully
Step 2
Edge strength is found out by taking the
gradient of the image
A Roberts mask or a Sobel mask can be used
Gy Gx Gy Gx G + ~ + =
2 2
10/29/2014 ECE - Sarbjeet Singh 34
Implementation of Canny Edge
Detector contd.
Step 3
Find the edge direction


Step 4
Resolve edge direction
|
.
|

\
|
=

Gx
Gy
1
tan u
10/29/2014 ECE - Sarbjeet Singh 35
Canny Edge Detector contd.
Step 5
Non-maxima suppression trace along
the edge direction and suppress any
pixel value not considered to be an edge.
Gives a thin line for edge
Step 6
Use double / hysterisis thresholding to
eliminate streaking
10/29/2014 ECE - Sarbjeet Singh 36
Canny Edge Detector contd.
Compare the results of Sobel and
Canny
10/29/2014 ECE - Sarbjeet Singh 37
Edge Detector Performance
Criteria
Probability of false edges
Probability of missing edges
Error in estimation of edge angle
Mean square distance of edge estimate
from true edge
Tolerance to distorted edges and other
features such as corners and junctions
10/29/2014 ECE - Sarbjeet Singh 38
Figure of Merit
Basic errors in a Edge Detector
Missing Edges
Error in localizing
Classification of noise as Edge



I
A
: detected edges
I
I
: ideal edges
d : distance between actual and ideal edges
o : penalty factor for displaced edges

=
+
=
IA
i
i I A
d I I
FM
1
2
1
1
) , max(
1
o
10/29/2014 ECE - Sarbjeet Singh 39
Applications
Enhancement of noisy images
satellite images, x-rays, medical
images like cat scans
Text detection
Mapping of roads
Video surveillance, etc.
10/29/2014 ECE - Sarbjeet Singh 40
Applications
Canny Edge Detector for Remote
Sensing Images
Reasons to go for Canny Edge Detector
Remote sensed images are inherently
noisy
Other edge detectors are very sensitive
to noise
10/29/2014 ECE - Sarbjeet Singh 41
Edge map of remote sensed image using Canny
10/29/2014 ECE - Sarbjeet Singh 42
Thank You
10/29/2014 ECE - Sarbjeet Singh 43
10/29/2014 ECE - Sarbjeet Singh 44
References
Machine Vision Ramesh Jain, Rangachar Kasturi, Brian G Schunck,
McGraw-Hill, 1995
INTRODUCTION TO COMPUTER VISION
AND IMAGE PROCESSING - by Luong Chi Mai
Department of Pattern Recognition and Knowledge Engineering
Institute of Information Technology, Hanoi, Vietnam
http://www.netnam.vn/unescocourse/computervision/computer.htm
The Hypermedia Image Processing Reference -
http://homepages.inf.ed.ac.uk/rbf/HIPR2/hipr_top.htm
A Survey and Evaluation of Edge Detection Operators Application to
Medical Images Hanene Trichili, Mohamed-Salim Bouhlel, Nabil Derbel,
Lotfi Kamoun, IEEE, 2002
Using The Canny Edge Detector for Feature Extraction and Enhancement of
Remote Sensing Images - Mohamed Ali David Clausi, Systems Design
Engineering, University of Waterloo, IEEE 2001
A Computational Approach to Edge Detection John Canny, IEEE, 1986

Vous aimerez peut-être aussi