An ntro to PCA: Edge Orentaton Estmaton Lecture #09 February 15 th, 2013
Revew: Edges Convoluton wth an edge mask estmates the partal dervatves of the mage surface. The Sobel edge masks are: " #!1 0 1!2 0 2!1 0 1 % & " #!1!2!1 0 0 0 1 2 1 % & Dx Dy 2
" #!1!2!1 0 0 0 1 2 1 % & " #!1 0 1!2 0 2!1 0 1 % & 0!1 0!1 4!1 0!1 0 3
Usng Dx & Dy (Revew) Convoluton produces two mages One of partal dervatves n di/dx One of partal dervatves n di/dy At any pxel (x,y): EdgeMagntude( x, y) = I x EdgeOrentaton x, y ( ) 2 + I y I ( ) = tan 1 y I x 2 4
Rotaton-Free Correlaton Pre-process: center the template on an edge For every Image wndow: Measure the drecton of the edge at the center pxel Rotate the template untl ts center pxel has the same orentaton Correlate the template & mage wndow 5
Rotaton-Free Correlaton (II) Use dfferent template orentaton at every poston At least blnear nterpolaton Skp postons wth no edge.e. mag 0 6
Problem: edge accuracy The orentaton of an edge may not be accurate Occluson Surface markng (smudge) Electronc nose Soluton: compute domnant edge orentaton over a wndow 7
Example dy dx 2/18/13 8
Computng Edge Orentaton Domnance How do we determne the domnant orentaton from a set of [dx, dy] vectors? Ft the lne that best fts the (dx, dy) ponts Represent edges as a matrx: G = I I I x1 x2 x n I I I y1 y2 y n 9
A general soluton Mean center the edge data Ft a lne the mnmzes the squared perpendcular dstances dy dx 10
Edge Covarance Compute the outer product of G wth tself: dx 1 dy 1 Cov = GG T = dx 1 dx 2 dx n dx 2 dy 2 = dy 1 dy 2 dy n dx n dy n Ths matrx s called the structure tensor What s the semantcs of the structure tensor? 2 dx dx dy 2 dx dy dy 11
Covarance Covarance s a measure of whether two sgnal are lnearly related Cov( A,B) = A A ( )( B B ) Note that ths s correlaton wthout normalzaton It predcts the lnear relatonshp between the sgnals.e. t can be used to ft a lne to them 12
Edge Covarance The structure tensor s the covarance matrx of the partal dervatves It tells you the lnear relaton between the dx and dy values If all the orentatons are the same, then dx predcts dy (and vce versa) If the orentatons are random, dx has no relaton to dy. 13
Introducton to Prncpal Components Analyss (PCA) We can solve the followng: GG T = R 1 λr Where R s an orthonormal (rotaton) matrx and λ s a dagonal matrx wth descendng values What do R and λ tell us? 14
Egenvalues and Egenvectors R s a rotaton matrx Its rows are axes of a new bass The 1 st row (egenvector) s the best ft drecton The 2 nd egenvector s orthogonal to the 1 st. λ contans the egenvalues The egenvalues are the covarance n the drectons of the new bases The closed form equaton smply computed the cosne of the frst egenvector 15
Corners (The Harrs Operator) The structure tensor s the outer product of the partal dervatves wth themselves: 2 dx dx dy C= 2 dx dy dy Consder the Egenvalues Both near zero => no edge One large, one near zero => edge Both large => a strong corner 2/18/13 16
Example Ponts from 2 Images Crea%ve Commons Lcense by Casey Marshall on Flckr 2/18/13 17
Back to Rotaton-Free Correlaton For every source wndow: Calculate the edge covarance matrx Fnd the frst egenvector Rotate the template to match Correlate 18