240-373: Chapter 8: Edge Detection
1
Montri [email protected]://fivedots.coe.psu.ac.th/~montri
240-373 Image Processing
240-373: Chapter 8: Edge Detection
2
Chapter 8
Edge Detection
240-373: Chapter 8: Edge Detection
3
Basic Edge Detection
• Edge detection, ideally, identifies all the lines that outline the objects in an image.
• Template for edge detection:
- 1Y_difference(x,y) = value(x,y) value(x,y+ )
ii iiiiiiiiii ii iiiiiiiiii iiii iiiii iiii i i2 1x template
1
-1
240-373: Chapter 8: Edge Detection
4
Basic Edge Detection
X_difference(x,y) = value(x,y) - value(x-1,y)
use the template-1 1
– Once X_difference and Y_difference are computed to create the single measurement of “gradient magnitude” (strength of the edge)
240-373: Chapter 8: Edge Detection
5
Basic Edge Detection
– It is also useful to divide Y_difference by X_difference and identify a gradient direction (the angle of the edge between the regions)
ceX_differen
ceY_differentan),(irectiongradient_d 1yx
240-373: Chapter 8: Edge Detection
6
Example
Image X_difference Y_difference Gradient Direction
1 1 1 1 1 0 0 0 0 * 0 0 0 0 0
* * * * *
1 1 1 1 1 0 0 0 0 * 0 0 0 1 1
* * *
- 1 1 1 0 0 0 0 1 0 * 0 0 1 0 0
* * * *
- 1 1 0 0 0 0 1 0 0 * 0 0 0 0 0
* * * *
- 1 1 0 0 0 0 1 0 0 * * * * * *
* * * *
240-373: Chapter 8: Edge Detection
7
Example
4Technique : Sobel edge detection 3 3The Sobel x templates are normally given
ii
i-iiiiiiiii i-iiiiiiiii- 1 0 1 1 2 1
- 202 0 0 0
- 1 0 1 - - -1 2 1
240-373: Chapter 8: Edge Detection
8
Example
Image abs A + abs B Threshold at 12
3444332100
2342334010
3333433100
3233420200
2420001000
3302000000
8642212122
42421014104
061216201086
414121410464
00000110
00000100
00111000
01110000
240-373: Chapter 8: Edge Detection
9
240-373: Chapter 8: Edge Detection
10
240-373: Chapter 8: Edge Detection
11
240-373: Chapter 8: Edge Detection
12
Second-order edge detection
• An image such as
• The basic Sobel vertical edge operator yields
987654321
987654321
987654321
987654321
987654321
101
202
101
8888888
8888888
8888888
240-373: Chapter 8: Edge Detection
13
Second-order edge detection
• Applying the edge operator again yields
• This is similar to the differentiation opera tor applied to a straight line, e.g.
if y 3= x - 2 , then
00000
0 and 32
2
dx
yd
dx
dy
240-373: Chapter 8: Edge Detection
14
Second-order edge detection
Laplacian template
– can reduce gradient of lighting– iiiiiiii iiiii
111
181
111
or
010
141
010
240-373: Chapter 8: Edge Detection
15
Pyramid Edge Detection
5:Technique Pyramid edge detection USE: To enhance substantial (strong and l
ong) edges but to ignore the weak or sho rt edges
THEORY:– iii ii iii ii iii iii i ii iiiiiii– iiii iiiii ii iii iiiiiii-iiii iiiii ii i
i iiiiiii ii iii iiii iiiiiiiiiiiii iiii - l s i n t he f ul l si ze i mage
240-373: Chapter 8: Edge Detection
16
Pyramid Edge Detection
THEORY: (cont’d)– This repeats until unwanted edges are invisi
iii– ii iiii iiiiiiii ii iiiiiii ii iii iiiiiiii
image and where edge pixels have been fou nd, an edge detector is applied to the corres
ponding four pixels in the next largest image
240-373: Chapter 8: Edge Detection
17
Pyramid Edge Detection
OPERATION:– iiiiii i iiiiii iiiii ii iiii 2m/ i 2n/
by eval uat i ng f or each i i0 < < and 0< j < n
– This is repeated and each generated image is kept
– With the smallest image, perform some edge detection--such as Sobel
)1,1()1,(),1(),(4
1
2,
2
jiIjiIjiIjiI
jiI
240-373: Chapter 8: Edge Detection
18
Pyramid Edge Detection
OPERATION: (cont’d)
– In pixels where edges are discovered, perform as edge detection operation on the group of four corresponding pixels in the next largest image
– Continue to find the best edges down through the pyramid of images until the main edges in the original image have been discovered
240-373: Chapter 8: Edge Detection
19
Edge Following
7Technique : Simple edge following USE: Knowing that a pixel is on an edge, the
edge will be followed so that an objected i s outlined
OPERATION:– Suppose that a position on the edge has been
identified, call it (x,y) and flag this position asused
– Evaluate all the 3x3 Sobel gradient values cen tered on each of the eight pixels surrounding (
x,y)
240-373: Chapter 8: Edge Detection
20
Edge Following
OPERATION: (cont’d)
– Choose the three pixels with the greatest abs olute gradient magnitude
– - Put these three pixel in a three column array– Order them in row according to the gradient
magnitude– Choose the one with greatest gradient magni
tude
240-373: Chapter 8: Edge Detection
21
Edge Following
OPERATION: (cont’d)
– - 07Now this pixel will be one of the direction wiii iiiiiii ii iii iiiii (x,y) iiiii ii iii iiiiii
ing map, where * is the position of pixel (x,y) 012
7*3
6 5 4
– iiii iii iiiiiiiii ii iiiiii d– iiiiii iii iiiiiiiii iii iiii ii iiii iiiiii ii
d , (d i+ 1 ) 8 , and (d- 1 8) mod iiiiiiiiii
240-373: Chapter 8: Edge Detection
22
Edge Following
OPERATION: (cont’d)
– If no suitable high value of gradient magnitu de is found, remove the pixel from the list an
d choose the next one of the three stored. M ove up one row if all three are removed
– Stop when the original pixel is reached, or ex ecution has gone too long, or the number of r
ii i ii iii iiii ii iiii iiiii
Top Related