Docsity

Image Processing: Edge Detection using Canny Algorithm and Image Pyramids - Prof. Brian Po, Study notes of Electrical and Electronics Engineering

Toggle sidebar
bg1
!!"#$%&'($")*+,-./$0121)3
4/153$6)-.-7
8599$:;;%
<.=-,/.$>?($!@A.$B.-.=C)3
#,AA.2-.@$D.5@13A
•8)/2E-F$G$6)3=.H$I")*+,-./$0121)3($J$K)@./3$
J++/)5=FLH$"F5+-./$%
M
N'
'
;
;
O)/17)3-59$B./1P5CP.
819-./
B8Q
B./1P5CP.2$J*+91RE$S)12.
6)T./$#+.=-/,*$)R$B./1P5CP.$819-./
UF5-$12$S)12.V
W3T53-.@$$1*5A.$5=X,121C)3$)/$-/532*1C)3
&
")**)3$QE+.2$)R$S)12.(
•819*$#=/5-=F.2$G$B,2-
•#59-$G$6.++./$S)12.
•Y*+,92.$S)12.
•J@@1CP.$#.32)/$S)12.
S)12.$5-$.5=F$+1Z.9$12$!"#$%$"#$"&
{
P[XY ]=P[X]P[Y]
(x1,y
1)!=(x2,y
2)
E[n(x1,y
1)n(x2,y
2)] = E[n(x1,y
1)]E[n(x2,y
2)]
⇒
E[XY ]=E[X]E[Y]
E[X]= 1
N
N
!
i=1
Xi
n(x, y)
hn(∆x, ∆y)=!
x,y
n(x, y)n(x+∆x, y +∆y)
=E[n(x, y)n(x+∆x, y +∆y)]
1
P[XY ]=P[X]P[Y]
(x1,y
1)!=(x2,y
2)
E[n(x1,y
1)n(x2,y
2)] = E[n(x1,y
1)]E[n(x2,y
2)]
⇒
E[XY ]=E[X]E[Y]
E[X]= 1
N
N
!
i=1
Xi
n(x, y)
hn(∆x, ∆y)=!
x,y
n(x, y)n(x+∆x, y +∆y)
=E[n(x, y)n(x+∆x, y +∆y)]
1
UF1-.$S)12.
[
!"#$%&'(#)%*&3)12.$P59,.$5-$.5=F$+1Z.9$12$A.3./5-.@$13@[email protected]
+,$(-(..%/01(2&3,2-1(2*
P[XY ]=P[X]P[Y]
(x1,y
1)!=(x2,y
2)
E[n(x1,y
1)n(x2,y
2)] = E[n(x1,y
1)]E[n(x2,y
2)]
⇒
E[XY ]=E[X]E[Y]
E[X]= 1
N
N
!
i=1
Xi
n(x, y)
hn(∆x, ∆y)=!
x,y
n(x, y)n(x+∆x, y +∆y)
=E[n(x, y)n(x+∆x, y +∆y)]
f(x, y)∗g(x, y)=!
i,j
f(x−i, y−j)g(i, j )
F[hn]=N(u, v)N(u, v)=|N(u, v )|2
1
4(25(/,1(2*
#*))-F13A$4.R)/.$B1\./.3C5C3A
]
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Image Processing: Edge Detection using Canny Algorithm and Image Pyramids - Prof. Brian Po and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

<.=-,/.$>?($!@A.$B.-.=C)

#,AA.2-.@$D.5@13A

  • 8)/2E-F$G$6)3=.H$I")*+,-./$0121)3($J$K)@./3$

J++/)5=FLH$"F5+-./$%

M

N' '

O)/17)3-59$B./1P5CP. 819-./

B8Q

B./1P5CP.2$J*+91RE$S)12.

6)T./$#+.=-/,*$)R$B./1P5CP.$819-./

UF5-$12$S)12.V

W3T53-.@$$15A.$5=X,121C)3$)/$-/5321C)

&

")**)3$QE+.2$)R$S)12.(

  • 819*$#=/5-=F.2$G$B,2-
  • #59-$G$6.++./$S)12.
  • Y*+,92.$S)12.
  • J@@1CP.$#.32)/$S)12.
S)12.$5-$.5=F$+1Z.9$12$ !"#$%$"#$"&

P[XY ] = P[X]P[Y ]

(x 1 , y 1 ) != (x 2 , y 2 )

E[n(x 1 , y 1 )n(x 2 , y 2 )] = E[n(x 1 , y 1 )]E[n(x 2 , y 2 )]

E[XY ] = E[X]E[Y ]

E[X] =

N

∑^ N

i=

Xi

n(x, y)

hn(∆x, ∆y) =

x,y

n(x, y)n(x+∆x, y+∆y)

= E[n(x, y)n(x+∆x, y+∆y)]

P[XY ] = P[X]P[Y ]

(x 1 , y 1 ) != (x 2 , y 2 )

E[n(x 1 , y 1 )n(x 2 , y 2 )] = E[n(x 1 , y 1 )]E[n(x 2 , y 2 )]

E[XY ] = E[X]E[Y ]

E[X] =

N

∑^ N

i=

Xi

n(x, y)

hn(∆x, ∆y) =

x,y

n(x, y)n(x+∆x, y+∆y)

= E[n(x, y)n(x+∆x, y+∆y)]

UF1-.$S)12.

[

!"#$%&'(#)%*& 3)12.$P59,.$5-$.5=F$+1Z.9$12$A.3./5-.@$13@[email protected]
P[XY ] = P[X]P[Y ]

(x 1 , y 1 ) != (x 2 , y 2 )

E[n(x 1 , y 1 )n(x 2 , y 2 )] = E[n(x 1 , y 1 )]E[n(x 2 , y 2 )]

⇒

E[XY ] = E[X]E[Y ]

E[X] =
N
∑^ N

i=

Xi

n(x, y)

hn(∆x, ∆y) =

x,y

n(x, y)n(x+∆x, y+∆y)

= E[n(x, y)n(x+∆x, y+∆y)]

f (x, y) ∗ g(x, y) =

i,j

f (x−i, y−j)g(i, j)

P[XY ] = P[X]P[Y ]

(x 1 , y 1 ) != (x 2 , y 2 )

E[n(x 1 , y 1 )n(x 2 , y 2 )] = E[n(x 1 , y 1 )]E[n(x 2 , y 2 )]

⇒

E[XY ] = E[X]E[Y ]

E[X] =

1

N

∑^ N

i=

Xi

n(x, y)

hn(∆x, ∆y) =

∑

x,y

n(x, y)n(x+∆x, y+∆y)

= E[n(x, y)n(x+∆x, y+∆y)]

f (x, y) ∗ g(x, y) =

∑

i,j

f (x−i, y−j)g(i, j)

F[hn] = N (u, v)N (u, v) = |N (u, v)|

2

#*))-F13A$4.R)/.$B1./.3C5C3A

]

∂f ∂x

= f (x + 1, y) − f (x, y) ∂f ∂x ∂f ∂y ∂f ∂x

2

∂f ∂y

2

5

∂f ∂x =^ f^ (x^ + 1, y)^ −^ f^ (x, y) ∂f ∂x ∂f ∂y ( (^) ∂f ∂x

) 2

( ∂f ∂y

) 2

5

?

!@A.$B.-.=C)

thresholding

∂f ∂x

= f (x + 1, y) − f (x, y) ∂f ∂x ∂f ∂y ∂f ∂x

2

∂f ∂y

2

5

∂f ∂x =^ f^ (x^ + 1, y)^ −^ f^ (x, y) ∂f ∂x ∂f ∂y ( (^) ∂f ∂x

) 2

( ∂f ∂y

) 2

5

%

!@A.$B.-.=C)

thresholding

<)=591713A$!@A.

^

  • QF/.2F)9@13A$$$$$$$$$$$$=53$/.2,[email protected]$+))/9E$9)=5917.@$.@A.
    • !2+.=1599E$R)/$F1AF$!

| !f |^2

σ

1

<)=591713A$!@A.

';

  • QF/.2F)9@13A$$$$$$$$$$$$=53$/.2,[email protected]$+))/9E$9)=5917.@$.@A.
    • !2+.=1599E$R)/$F1AF$!

| !f |^2

σ

1

6(/,1(2* $Y32-.5@$)R$-F/.2F)9@13A$-F.$_/2-$@./1P5CP.H

_3@$7./)N=/)2213A2$)R$-F.$2.=)3@$@./1P5CP.

| !f |^2

σ

tan θ =

fx

fy

θ = arctan

fx

fy

"f =

∂^2 f

∂x^2

∂^2 f

∂y^2

K5//NO19@/.-F$!@A.$B.-.=C)

''

6(/,1(2* $Y32-.5@$)R$-F/.2F)9@13A$-F.$_/2-$@./1P5CP.H

_3@$7./)N=/)2213A2$)R$-F.$2.=)3@$@./1P5CP.

")**)3$:3@$/@./$B./1P5CP.$+./5-)/( (^) 708/0-#

| !f |^2

σ

tan θ =

fx

fy

θ = arctan

fx

fy

"f =

∂^2 f

∂x^2

∂^2 f

∂y^2

K5//NO19@/.-F$!@A.$B.-.=C)

':

6(/,1(2* $Y32-.5@$)R$-F/.2F)9@13A$-F.$_/2-$@./1P5CP.H

_3@$7./)N=/)2213A2$)R$-F.$2.=)3@$@./1P5CP.

")**)3$:3@$/@./$B./1P5CP.$+./5-)/( (^) 708/0-#

| !f |^2

σ

tan θ =

fx

fy

θ = arctan

fx

fy

"f =

∂^2 f

∂x^2

∂^2 f

∂y^2

K5//NO19@/.-F$!@A.$B.-.=C)

'^

6(/,1(2* $Y32-.5@$)R$-F/.2F)9@13A$-F.$_/2-$@./1P5CP.H

_3@$7./)N=/)2213A2$)R$-F.$2.=)3@$@./1P5CP.

")**)3$:3@$/@./$B./1P5CP.$+./5-)/( (^) 708/0-#

K5//NO19@/.-F$!@A.$B.-.=C)

:;

6(/,1(2* $Y32-.5@$)R$-F/.2F)9@13A$-F.$_/2-$@./1P5CP.H

_3@$7./)N=/)2213A2$)R$-F.$2.=)3@$@./1P5CP.

[email protected]$=53$a.$9)=5917.@$-)$2,aN+1Z.9$5==,/5=Ed

4,-H$599$=)3-),/2$ /0*& $a.$=9)2.@($#+5AF.e

<)=591713A$!@A.

:'

  • QF/.2F)9@13A$$$$$$$$$$$$=53$/.2,[email protected]$+))/9E$9)=5917.@$.@A.
    • !2+.=1599E$R)/$F1AF$!

| !f |^2

σ

1

| !f |^2 σ

<)=591713A$!@A.

::

  • QF/.2F)9@13A$$$$$$$$$$$$=53$/.2,[email protected]$+))/9E$9)=5917.@$.@A.
    • !2+.=1599E$R)/$F1AF$!

| !f |^2

σ

1

| !f |^2

σ

6(/,1(2* $8)/$.5=F$+1Z.9$5a)P.$-F/.2F)9@H$_3@$-F.$9)=59$5Z1,*$)R$

$$$$$$$$$$$$$$$$$59)3A$-F.$@1/.=C)3$)R$-F.$A/[email protected]$

| !f |^2 σ

| !f |^2

σ

tan θ =

fy

fx

θ = arctan

fx

fy

"f =

∂^2 f ∂x^2

∂^2 f ∂y^2

!

| !f |

2 )^

· !f = 2f

2 x fxx^ + 4fxfy^ fxy^ + 2f^

2 y fyy

!

| !G|
2 )^
· !G

S)3NK5Z1,$#,++/.221)

:M

| !f |^2

σ ")+,-.$.@A.$@1/.=C)3$R/)$1*5A.$A/[email protected](

Y*5A.$=)3P)9P.@$T1-F$@./1P5CP.$)R$f5,22153H$ -F/.2F)9@.@H$53@$=)9)/.@$aE$.@A.$@1/.=C)3d

6(/,1(2* $8)/$.5=F$+1Z.9$5a)P.$-F/.2F)9@H$_3@$-F.$9)=59$5Z1,*$)R$

$$$$$$$$$$$$$$$$$59)3A$-F.$@1/.=C)3$)R$-F.$A/[email protected]$ 'g ;".%)"(/<&$"%&=.0<#%2$&>0=2#$,<%

:g ?#)-.%1@%&****! &AB&CDE&#2-.%>%2$)

Mg F%%8&%<=%&8#G%/)&(2/B&#9&&&&&&&&&&&&&&&&&#)&=.%0$%.&$"02&$"%&H&2%#="A(.)&0/(2=& $"%&%<=%&2(.>0/I

S)3NK5Z1,$#,++/.221)

:&

?#)-.%$%&4022B&J<=%&K8%.0$(.*

| !f |^2

σ

| !f |^2

σ

| !f |^2

σ

1

'g ;".%)"(/<&$"%&=.0<#%2$&>0=2#$,<%

:g ?#)-.%1@%&****! &AB&CDE&#2-.%>%2$)

Mg F%%8&%<=%&8#G%/)&(2/B&#9&&&&&&&&&&&&&&&&&#)&=.%0$%.&$"02&$"%&H&2%#="A(.)&0/(2=& $"%&%<=%&2(.>0/I

S)3NK5Z1,$#,++/.221)

:[

?#)-.%$%&4022B&J<=%&K8%.0$(.*

| !f |^2

σ

1

| !f |^2

σ

1

'g ;".%)"(/<&$"%&=.0<#%2$&>0=2#$,<%

:g 4(>8,$%&$"%&<%.#5015%&(9&&&&&&&&&&&&&&&&#2&$"%&<#.%-1(2&(9&$"%&%<=%&2(.>0/

Mg 3#2<&@%.()&(9&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&L"%.%&&&&&&&&&&&&&&&&&#)&0A(5%&$".%)"(/<

4(212,(,)&4022B&J<=%&K8%.0$(.*

| !f |^2

σ

1

| !f |^2

σ

tan θ =

fx

fy

θ = arctan

fx

fy

"f =

∂^2 f

∂x^2

∂^2 f

∂y^2

!

| !f |

2 )^

· !f = 2f

2 x fxx^ + 4fxfy^ fxy^ + 2f^

2 y fyy

| !f |^2

σ

1

| !f |^2 σ

tan θ =

fx fy

θ = arctan

( fx fy

)

"f =

∂^2 f ∂x^2

∂^2 f ∂y^2 !

( | !f |^2

) · !f = 2f (^) x^2 fxx + 4fxfy fxy + 2f (^) y^2 fyy

1

| !f |^2

σ

1

'g ;".%)"(/<&$"%&=.0<#%2$&>0=2#$,<%

:g ?#)-.%1@%&****! &AB&CDE&#2-.%>%2$)

Mg F%%8&%<=%&8#G%/)&(2/B&#9&&&&&&&&&&&&&&&&&#)&=.%0$%.&$"02&$"%&H&2%#="A(.)&0/(2=& $"%&%<=%&2(.>0/I

S)3NK5Z1,$#,++/.221)

:]

?#)-.%$%&4022B&J<=%&K8%.0$(.*

| !f |^2

σ

1

| !f |^2

σ

1

'g ;".%)"(/<&$"%&=.0<#%2$&>0=2#$,<%

:g 4(>8,$%&$"%&<%.#5015%&(9&&&&&&&&&&&&&&&&#2&$"%&<#.%-1(2&(9&$"%&%<=%&2(.>0/

Mg 3#2<&@%.()&(9&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&L"%.%&&&&&&&&&&&&&&&&&#)&0A(5%&$".%)"(/<

4(212,(,)&4022B&J<=%&K8%.0$(.*

| !f |^2

σ

1

| !f |^2

σ

tan θ =

fx

fy

θ = arctan

fx

fy

"f =

∂^2 f

∂x^2

∂^2 f

∂y^2

!

| !f |

2 )^

· !f = 2f

2 x fxx^ + 4fxfy^ fxy^ + 2f^

2 y fyy

| !f |^2

σ

1

| !f |^2 σ

tan θ =

fx fy

θ = arctan

( fx fy

)

"f =

∂^2 f ∂x^2

∂^2 f ∂y^2 !

( | !f |^2

) · !f = 2f (^) x^2 fxx + 4fxfy fxy + 2f (^) y^2 fyy

1

| !f |^2 σ

tan θ =

fx fy

θ = arctan

( fx fy

)

"f =

∂^2 f ∂x^2

∂^2 f ∂y^2 !

( | !f |^2

) · !f = 2f (^) x^2 fxx + 4fxfy fxy + 2f (^) y^2 f

!

( | !G|^2

) · !G

1

:?

K5//NO19@/.-F
!@A.$B.-.=C)
"533E
!@A.$B.-.=C)

Edge Thresholding

  • Standard Thresholding:
    • Can only select “strong” edges.
    • Does not guarantee “continuity”.
  • Thresholding with Hysteresis (use two thresholds)

Example: For “maybe” edges, decide on the edge if neighboring pixel is a strong edge.

Choice of! Determines Features

  • Large_!_ results in coarse, large scale features
  • Small_!_ results in fine, small scale features

Canny with_!_ = 1

Choice of! Determines Features

  • Large_!_ results in coarse, large scale features
  • Small_!_ results in fine, small scale features

Canny with_!_ = 2

Edge Detection using Pyramids

Coarse-to-fine strategy:

  • Do edge detection at higher level.
  • Consider edges of finer scales only near the edges of higher scales.

Fast Template Matching

Fast Template Matching

Level 3 Search

At the lowest pyramid level, search the entire

image with the template

40

Level 2 Search

Subsequent searches are constrained to a small

neighborhood surrounding good matches from the

next coarser level.

41

Level 1 Search

42

Subsequent searches are constrained to a small

neighborhood surrounding good matches from the

next coarser level.

Level 0 Search

43

Coarse-to-fine search reduced total search time

(in Matlab) from 31 seconds to 0.5 seconds.

Difference of Gaussians (DoG)

  • Laplacian of Gaussian can be approximated by the

difference between two different Gaussians

expand

expand

expand

Gaussian Pyramid Laplacian Pyramid

The Laplacian Pyramid

  • =
  • (^) =
  • (^) =

48