Chap. 5 — Edge Detection Edge Detectionagomes/cvm/teoricas/05-edgedetection.pdf · Edge Detection...

24
Edge Detection Computação Visual e Multimédia 10504: Mestrado em Engenharia Informática Chap. 5 — Edge Detection

Transcript of Chap. 5 — Edge Detection Edge Detectionagomes/cvm/teoricas/05-edgedetection.pdf · Edge Detection...

Edge Detection

Computação Visual e Multimédia

10504: Mestrado em Engenharia Informática

Chap. 5 — Edge Detection

Chapter 5: Edge Detection

Outline

Chapter 5: Edge Detection Monochrome image ���segmentation algorithms

http

://w

ww

.cs.

bgu.

ac.il

/~kl

ara/

ATC

S111

/gon

zale

s_10

.1_1

0.2.

pdf

Chapter 5: Edge Detection

Chapter 5: Edge Detection Isolated point detection ���(Laplacian-based)

http

://w

ww

.cs.

bgu.

ac.il

/~kl

ara/

ATC

S111

/gon

zale

s_10

.1_1

0.2.

pdf

0 1 01 −4 10 1 0

⎢ ⎢ ⎢

⎥ ⎥ ⎥

−1 −1 −1−1 8 −1−1 −1 −1

⎢ ⎢ ⎢

⎥ ⎥ ⎥

Laplacian mask other typical mask

original image

masked image thresholded image

Chapter 5: Edge Detection Line detection���(Laplacian-based)

http

://w

ww

.cs.

bgu.

ac.il

/~kl

ara/

ATC

S111

/gon

zale

s_10

.1_1

0.2.

pdf

original image Positive/negative double line effect of Laplacian

absolute value of the Laplacian

positive values of the Laplacian

Chapter 5: Edge Detection

Line detection

http

://w

ww

.cs.

bgu.

ac.il

/~kl

ara/

ATC

S111

/gon

zale

s_10

.1_1

0.2.

pdf

binary wire-bond mask absolute value with a -45º line detector

Result of threshold image

−1 −1 −12 2 2−1 −1 −1

⎢ ⎢ ⎢

⎥ ⎥ ⎥

−1 −1 2−1 2 −12 −1 −1

⎢ ⎢ ⎢

⎥ ⎥ ⎥

−1 2 −1−1 2 −1−1 2 −1

⎢ ⎢ ⎢

⎥ ⎥ ⎥

2 −1 −1−1 2 −1−1 −1 2

⎢ ⎢ ⎢

⎥ ⎥ ⎥

horizontal 45º vertical -45º

Chapter 5: Edge Detection

Edge models

http

://w

ww

.cs.

bgu.

ac.il

/~kl

ara/

ATC

S111

/gon

zale

s_10

.1_1

0.2.

pdf

step edge ramp edge roof edge

intensity profiles for different types of edges

Chapter 5: Edge Detection

Edge models: derivatives

gray-scale profile

1st derivative

2nd derivative

Chapter 5: Edge Detection Edge models: derivatives���(cont’d)

5 7 6 4 152 148 149

GX (4) = −12× 6 + 0 × 4 +

12×152

LX (4) =1× 6 − 2 × 4 +1×152

Chapter 5: Edge Detection Basic edge detection ���(gradient-based)

Sobel filter provides a better noise supression than Prewitt filter

original image |GY| |GX| |GX|+|GY|

Chapter 5: Edge Detection

Advanced edge detection

Chapter 5: Edge Detection

LoG edge detection (Marr-Hildreth)

http

://eu

clid

.ii.m

etu.

edu.

tr/~

ion5

28/d

emo/

lect

ures

/6/3

/inde

x.ht

ml

1st derivative f ’

2nd derivative f ’’

function f

zero crossing

Chapter 5: Edge Detection

LoG edge detection (Marr-Hildreth)

LoG =∇2G(x,y) =x 2 + y 2 − 2σ2

σ4⎡

⎣ ⎢

⎦ ⎥ e

−x 2 +y 2

2σ 2

G(x,y) = e−x 2 +y 2

2σ 2

Since LoG filter is linear, the two constituent filters (Gaussian and Laplacian) can be applied separately, thus allowing us to use different sized filters for each of the actions.

L(x,y)⊗G(x,y)⊗ f (x,y)

Chapter 5: Edge Detection LoG edge detection (Marr-Hildreth)���(1st alternative)

Chapter 5: Edge Detection LoG edge detection (Marr-Hildreth)���(2nd alternative)

0 0 −1 0 00 −1 −2 −1 0−1 −2 16 −2 −10 −1 −2 −1 00 0 −1 0 0

⎢ ⎢ ⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥ ⎥ ⎥

LoG mask = approximation to the shape of

G(x,y) = e−x 2 +y 2

2σ 2

LoG =∇2G(x,y) =x 2 + y 2 − 2σ2

σ4⎡

⎣ ⎢

⎦ ⎥ e

−x 2 +y 2

2σ 2

∇2G

∇2G

- black is negative; - gray is the zero plane - white is positive

cross section showing zero crossings

∇2G

Chapter 5: Edge Detection

Canny edge detection

http

://eu

clid

.ii.m

etu.

edu.

tr/~

ion5

28/d

emo/

lect

ures

/6/4

/inde

x.ht

ml

Chapter 5: Edge Detection Canny edge detection (1st step):���smooth image

S(x,y) =Gσ (x,y)⊗ f (x,y)

Output: a smoothed/nonnoisy image S(x,y)

Chapter 5: Edge Detection Canny edge detection (2nd step):���compute gradient

GX (x,y) ≈ S(x,y +1) − S(x,y) + S(x +1,y +1) − S(x +1,y)[ ] /2GY (x,y) ≈ S(x,y) − S(x +1,y) + S(x,y +1) − S(x +1,y +1)[ ] /2

G(x,y) = GX2 (x,y) +GY

2 (x,y)

θ(x,y) = tan−1 GY2 (x,y)

GX2 (x,y)

⎝ ⎜

⎠ ⎟

Output: 2 arrays of the same size as the image: - gradient magnitude array G(x,y) - gradient angle array θ(x,y)

Chapter 5: Edge Detection Canny edge detection (3rd step):���non-maxima suppression

Output: 1 array of the same size as the image: - non-maxima suppressed array N(x,y)

Chapter 5: Edge Detection Canny edge detection (4th step):���double thresholding (hysteresis thresholding)

Double thresholding = false edge point reduction + edge linking

Chapter 5: Edge Detection Canny edge detection (cont’d):���double thresholding

Double thresholding = false edge point reduction + edge linking

Chapter 5: Edge Detection Canny edge detection:���revisited

original image Step 2: G(x,y) with σ=2.0

Step 3 Step 4: TL=10 and TH=50

Chapter 5: Edge Detection

Summary: