0% found this document useful (0 votes)
196 views

Edge Detection and Linking

The document describes the stages of edge detection in images. It discusses: 1. Filtering to enhance image quality by smoothing using filters like Gaussian filters to suppress noise without affecting true edges. 2. Differentiation to distinguish edge pixels from other pixels by calculating the first and second derivatives to detect edges where the first derivative is above a threshold and the second derivative changes signs. 3. Localization to accurately determine the location of detected edges by thinning edges and connecting edge fragments.

Uploaded by

arya dadhich
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
196 views

Edge Detection and Linking

The document describes the stages of edge detection in images. It discusses: 1. Filtering to enhance image quality by smoothing using filters like Gaussian filters to suppress noise without affecting true edges. 2. Differentiation to distinguish edge pixels from other pixels by calculating the first and second derivatives to detect edges where the first derivative is above a threshold and the second derivative changes signs. 3. Localization to accurately determine the location of detected edges by thinning edges and connecting edge fragments.

Uploaded by

arya dadhich
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 45

Stages in Edge Detection

• To detect the sharp changes in the brightness


to capture events and properties.
1. Filtering
– It uses filters to enhance the quality of the edges
in the image (usually gaussian filters are used)
– It involves smoothing where the noise is
suppressed without affecting the true edges
2. Differentiation
– It distinguishes edge pixels from the other
pixels
Stages in Edge Detection
– Non-zero difference indicates the presence of an
edge point.
– A point is an edge point if its first derivative is
greater than the user specified threshold and it
encounters a sign change(zero crossing) in second
order derivative.
Edge detection
• Consider an image strip
• I = 60 60 60 100 100 100
• First order derivative:
0 0 40 0 0
Second order derivative:
0 40 -40 0
High value 40 indicates the presence of an edge in first order
derivative
Sign change in second order derivative represents the edges
Steps in edge detection contd
• Localization
– The detected edges are localized.
– Localization involves in determining the exact
location of the edge.
– It involves edge thinning and edge linking.
– This is done to ensure that the edges are sharp
and connected.
Types of edge detectors
• Gradient or derivative filters
• Template matching filters
• Gaussian derivatives
• Pattern fit approach
Types of edge detectors
• Derivative filters
– It uses differentiation technique to detect the
edges.
• Template matching filters
– It uses templates that resemble the target shapes
and match with the image.
– If there is a match obtained , it is indicated the
maximum gradient value.
– Point detection and line detection are best
examples
Types of edge detectors
Pattern fit
• Here the surface is considered as topographic
surface with the pixel value representing the
altitude.
• The aim is to fit a pattern over a
neighbourhood of a pixel where the edge
strength is calculated.
First order edge detection operators
• Local transitions among different image
intensities constitute an edge.
• The aim is to measure intensity
gradient
• The differences between the pixels are quantified
by the gradient magnitude.
• The direction of greatest change is given by the
edge vector
• This gives the direction of the edge.
• This can be done by finding the differences
First order edge detection operators
• The approaches as as follows
First order edge detection operators
Roberts operator
• Let f(x,y) and f(x+1,y) be the neighbouring
pixels.
• The difference between the adjacent pixels is
obtained by applying the mask [1-1] directly to
the image to get the difference between the
pixels.
First order edge detection operators
Roberts operator
• Roberts kernel are derivative with respect to
the diagonal elements.
• Hence they are cross-gradient operators.
• They are based on the cross
diagonal differences.
• Roberts mask for cross difference is
First order edge detection operators
• The approximation of Roberts operator is
given by

• The magnitude can be calculated as


First order edge detection operators
• The edge orientation is given by
First order edge detection operators
• The generic gradient based algorithm can be
given as
• Read the image and smooth it
• Convolve the image with gx.
• Convolve the image with gy
• Compute edge magnitude and edge
orientation
• Compare the edge magnitude with a threshold
value.
• If the edge magnitude is higher assign it as a
possible edge point.
First order edge detection operators
• Prewitts Operator
• The mask of size 2x2 does not
provide a clear content
• So a 3x3 mask size is give by
• In this the difference between the third and
first rows of the 3x3 image region
approximates the derivative in the x-direction
• Gx=(z7+z8+z9)-(z1+z2+z3)
First order edge detection operators
Prewitts Operator
• In this the difference between the third and first
columns of the 3x3 image region approximates the
derivative in the y-direction
• Gy=(z3+z6+z9)-(z1+z4+z7)
• Prewitts mask:
-1 -1 -1 -1 0 1
0 0 0 -1 0 1
1 1 1 -1 0 1

• Prewitts is sensitive to noise


First order edge detection operators
Sobels Operator
• Sobel also relies on central differences
• A weight of value 2 is used to achieve
smoothing
• It has superior noise suppression
characteristics
• Gx=(z3+2z6+z9)-(z1+2z4+z7)
• Gy=(z3+2z6+z9)-(z1+2z4+z7)
First order edge detection operators
Sobels Operator
• sobel mask:

-1 -2 -1 -1 0 1
0 0 0 -2 0 2
1 2 1 -1 0 1

Diagonal mask:
Prewitts

Sobel
Second order derivative masks
• Laplacian is sensitive to noise and it produces
double edges
• It is useful when combined with smoothing.
Laplacian filter
Differentiation measures the rate of change of a
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

function
Let’s consider a simple 1 dimensional example
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Spatial Differentiation
A
B
1st Derivative
The formula for the 1st derivative of a function is
as follo w s:
 f

 f (x 1)  f (x)
x

It’s just the difference between subsequent


values and measures the rate of change of the
function
1st Derivative (cont…)
8
7
6
5
4
3
2
1
0

5 5 4 3 2 1 0 0 0 6 0 0 0 0 1 3 1 0 0 0 0 7 7 7 7
Applying the formula
0 -1 -1 -1 -1 0 0 6 -6 0 0 10 2 -2 -1 0 0 0 7 0 0 0
8
0 -1 -1 -1 -1 -1 0 0 6 -6 0 0 0 1 2 -2 -1 0 0 7 0 0
6
0 0
4
2
0
-2
-4
-6
-8
It sharpens edges
First order derivative generally produces thicker edges
in an image.
Second order derivative give stronger response to fine
details such as thin lines and isolated points
First order derivative have stronger response to
grey level step
Second order derivative produce a double response at
step edges
2nd Derivative
The formula for the 2nd derivative of a function is
as fo lo2w s:
 f
 f (x 1)  f (x 1)  2 f
 x
2
(x)
Simply takes into account the values both before
and after the current value
8
2nd Derivative (cont…)
7
6
5
4
3
2
1
0

5 5 4 3 2 1 0 0 0 6 0 0 0 0 1 3 1 0 0 0 0 7 7 7 7
first derivative 0 -1 -1 -1 -1 0 0 6 -6 0 0 0 1 0 0 7 0 0 0
second derivative
-1 0 0 0 0 1 0 6 -12 6 0 0 1 1 -4 1 1 0 0 7 -7 0 0
2 -2 -1 0
10

-5

-10

-15
Point detection
• An isolated point is a point whose grey level is
significantly different from its background in a
homogeneous area.
Point detection
• The mask is superimposed onto a image and the
convolution process is applied.
• Response of the mask is given as

• Where fk is the grey values of the pixels


associated with the image.
• Threshold value T is used to identify the
points.
Point detection
• A point is said to be detected at the location
on which the mask is centred if |R| ≥ T
• The point detection mask is shown below:
Line Detection
• In line detection, four types of masks are used
to get the responses R1, R2, R3, and R4 for
four directions vertical, horizontal, 45 degrees
and - 45 degrees
• These masks are applied to the image.
• R1 is the response for moving the mask from
left to right of its image
• R2 is the response for moving the mask from
top to bottom of its image
Line Detection
By moving the mask over the
entire image, it detect all
those points which lie on the
horizontal line
• If we move this mask on the
entire image it will help to detect
all the point in the image which
are lying on the line which is
inclined at an angle of 45
degrees.
• Help to detect all the point
which lie on the vertical line
• Detect the points which
are lying on the line which
are inclined at an angle of -
45 degrees
Line Detection

Mask Image
Matrix
= -1*z1-1*z2-1*z3:2*z4+2*z5+2*z6-1*z7-
1*z8- 1*z9
• For line detection apply all the 4 masks on the
image.
• If the above condition is satisfied, the
corresponding point is more associated with
the line with the corresponding mask i.
Aliter: Line Detection
• R(x, y) = max(|R1(x, y)|, |R2(x, y)|, |R3(x, y)|,
|R4(x, y)|)
Aliter
Prewitt Operator
calculate the resulting new p5 pixel is pixel = (p1+p2+p3-p7-p8- p9)+
(p3+p6+p9-p1-p4-p7)
Prewitts gradient = SQRT((X*X)+(Y*Y))
where X = (p1+p2+p3-p7-p8-p9) and Y = (p3+p6+p9-p1-p4-p7)
Sobel Operator

Sobel gives an averaging effect on the image


It reduces the furious edges
new_pixel_intensity = (p1+(p2+p2)+p3-p7-(p8+p8)- p9)+(p3+
(p6+p6)+p9-p1-(p4+p4)-p7)
new_pixel_intensity = SQRT((X*X)+(Y*Y)) where X = (p1+
(p2+p2)+p3-p7-(p8+p8)-p9) and Y = (p3+(p6+p6)+p9-p1-(p4+p4)-
p7)
Edge Segmentation

You might also like