harris corners
play

Harris Corners 16-385 Computer Vision (Kris Kitani) Carnegie Mellon - PowerPoint PPT Presentation

Harris Corners 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University How do you find a corner? [Moravec 1980] Easily recognized by looking through a small window Shifting the window should give large change in intensity Easily


  1. Harris Corners 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University

  2. How do you find a corner? [Moravec 1980] Easily recognized by looking through a small window Shifting the window should give large change in intensity

  3. Easily recognized by looking through a small window Shifting the window should give large change in intensity “edge”: 
 “flat” region: 
 “corner”: 
 no change along the edge no change in all significant change in all direction directions directions [Moravec 1980]

  4. Design a program to detect corners (hint: use image gradients)

  5. Finding corners (a.k.a. PCA) I y = ∂ I I x = ∂ I ∂ y ∂ x 1.Compute image gradients over small region 2.Subtract mean from each image gradient 3.Compute the covariance matrix P P 2 I x I x I x I y 3 p ∈ P p ∈ P 4 5 P P I y I x I y I y 4.Compute eigenvectors and p ∈ P p ∈ P eigenvalues 5.Use threshold on eigenvalues to detect corners

  6. 1. Compute image gradients over a small region (not just a single pixel)

  7. 1. Compute image gradients over a small region (not just a single pixel) array of x gradients I x = ∂ I ∂ x array of y gradients I y = ∂ I ∂ y

  8. visualization of gradients image X derivative Y derivative

  9. I y = ∂ I I y = ∂ I I y = ∂ I ∂ y ∂ y ∂ y I x = ∂ I I x = ∂ I I x = ∂ I ∂ x ∂ x ∂ x What does the distribution tell you about the region?

  10. I y = ∂ I I y = ∂ I I y = ∂ I ∂ y ∂ y ∂ y I x = ∂ I I x = ∂ I I x = ∂ I ∂ x ∂ x ∂ x distribution reveals edge orientation and magnitude

  11. I y = ∂ I I y = ∂ I I y = ∂ I ∂ y ∂ y ∂ y I x = ∂ I I x = ∂ I I x = ∂ I ∂ x ∂ x ∂ x How do you quantify orientation and magnitude?

  12. 2. Subtract the mean from each image gradient

  13. 2. Subtract the mean from each image gradient plot intensities constant intensity gradient intensities along the line

  14. 2. Subtract the mean from each image gradient plot intensities constant intensity gradient intensities along the line I y = ∂ I ∂ y subtract mean I x = ∂ I ∂ x plot of image gradients

  15. 2. Subtract the mean from each image gradient plot intensities constant intensity gradient intensities along the line I y = ∂ I I y = ∂ I ∂ y ∂ y subtract mean I x = ∂ I I x = ∂ I ∂ x ∂ x data is centered plot of image gradients (‘DC’ offset is removed)

  16. 3. Compute the covariance matrix

  17. 3. Compute the covariance matrix P P 2 I x I x I x I y 3 p ∈ P p ∈ P 4 5 P P I y I x I y I y p ∈ P p ∈ P I x = ∂ I I y = ∂ I ∂ x ∂ y =sum( ) *. P I x I y p ∈ P P array of x gradients array of y gradients Where does this covariance matrix come from?

  18. Some mathematical background… Error function Change of intensity for the shift [ u,v ]: Error Window Shifted Intensity function function intensity Window function w(x,y) = or 1 in window, 0 outside Gaussian

  19. Error function approximation Change of intensity for the shift [ u,v ]: Second-order Taylor expansion of E(u,v) about (0,0) (bilinear approximation for small shifts): first derivative second derivative

  20. Bilinear approximation For small shifts [ u,v ] we have a ‘bilinear approximation’: Change in appearance for a shift [u,v] where M is a 2 × 2 matrix computed from image derivatives: ‘second moment’ matrix ‘structure tensor’ M

  21. By computing the gradient covariance matrix… P P I x I x I x I y 2 3 p ∈ P p ∈ P 4 5 P P I y I x I y I y p ∈ P p ∈ P we are fitting a quadratic to the gradients over a small image region

  22. Visualization of a quadratic The surface E ( u , v ) is locally approximated by a quadratic form

  23. Which error surface indicates a good image feature? What kind of image patch do these surfaces represent?

  24. flat edge corner ‘line’ ‘dot’

  25. 4. Compute eigenvalues and eigenvectors

  26. eig(M)

  27. 4. Compute eigenvalues and eigenvectors eigenvalue M e = λ e ( M − λ I ) e = 0 eigenvector

  28. 4. Compute eigenvalues and eigenvectors eigenvalue M e = λ e ( M − λ I ) e = 0 eigenvector M − λ I 1. Compute the determinant of (returns a polynomial)

  29. 4. Compute eigenvalues and eigenvectors eigenvalue M e = λ e ( M − λ I ) e = 0 eigenvector M − λ I 1. Compute the determinant of (returns a polynomial) 2. Find the roots of polynomial (returns eigenvalues) det( M − λ I ) = 0

  30. 4. Compute eigenvalues and eigenvectors eigenvalue M e = λ e ( M − λ I ) e = 0 eigenvector M − λ I 1. Compute the determinant of (returns a polynomial) 2. Find the roots of polynomial (returns eigenvalues) det( M − λ I ) = 0 3. For each eigenvalue, solve ( M − λ I ) e = 0 (returns eigenvectors)

  31. Visualization as an ellipse Since M is symmetric, we have We can visualize M as an ellipse with axis lengths determined by the eigenvalues and orientation determined by R direction of the fastest change Ellipse equation: direction of the slowest change ( λ max ) -1/2 ( λ min ) -1/2

  32. interpreting eigenvalues λ 2 λ 2 >> λ 1 What kind of image patch does each region represent? λ 1 ∼ 0 λ 1 >> λ 2 λ 2 ∼ 0 λ 1

  33. interpreting eigenvalues λ 2 corner ‘horizontal’ edge λ 2 >> λ 1 λ 1 ~ λ 2 λ 1 >> λ 2 flat ‘vertical’ edge λ 1

  34. interpreting eigenvalues λ 2 corner ‘horizontal’ edge λ 2 >> λ 1 λ 1 ~ λ 2 λ 1 >> λ 2 flat ‘vertical’ edge λ 1

  35. 5. Use threshold on eigenvalues to detect corners

  36. 5. Use threshold on eigenvalues to detect corners λ 2 Think of a function to score ‘cornerness’ flat λ 1

  37. 5. Use threshold on eigenvalues to detect corners λ 2 strong corner Think of a function to score ‘cornerness’ flat λ 1

  38. ���������������� 5. Use threshold on eigenvalues to detect corners ^ λ 2 corner Use the smallest eigenvalue as the response function R = min( λ 1 , λ 2 ) flat λ 1

  39. ���������������� 5. Use threshold on eigenvalues to detect corners ^ λ 2 corner Eigenvalues need to be bigger than one. R = λ 1 λ 2 − κ ( λ 1 + λ 2 ) 2 Can compute this more efficiently… flat λ 1

  40. ���������������� 5. Use threshold on eigenvalues to detect corners ^ λ 2 corner R < 0 R > 0 R = det( M ) − κ trace 2 ( M ) R < 0 R ⌧ 0 flat λ 1

  41. Harris & Stephens (1988) R = det( M ) − κ trace 2 ( M ) Kanade & Tomasi (1994) R = min( λ 1 , λ 2 ) Nobel (1998) det( M ) R = trace( M ) + �

  42. Harris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 1. Compute x and y derivatives of image x y I G I I G I = ∗ = ∗ x y σ σ 2. Compute products of derivatives at every pixel I I I I I I I I I = ⋅ = ⋅ = ⋅ x x y y xy x y 2 2 y x 3. Compute the sums of the products of derivatives at each pixel S G I S G I S G I = ∗ = ∗ = ∗ ' 2 2 ' 2 2 y σ y xy ' xy σ x x σ

  43. Harris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel S ( x , y ) S ( x , y ) & # xy 2 x M ( x , y ) = $ ! S ( x , y ) S ( x , y ) $ ! xy 2 % " y Compute the response of the detector at each pixel 5. 2 ( ) R det M k trace M = − Threshold on value of R; compute non-max 6. suppression.

  44. Corner response

  45. Thresholded corner response

  46. Non-maximal suppression

  47. Harris corner response is rotation invariant Ellipse rotates but its shape ( eigenvalues ) remains the same Corner response R is invariant to image rotation

  48. intensity changes Partial invariance to affine intensity change ü Only derivatives are used => invariance to intensity shift I → I + b ü Intensity scale: I → a I R R threshold x (image coordinate) x (image coordinate)

  49. The Harris detector not invariant to changes in …

Recommend


More recommend