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

harris corners
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Harris Corners

16-385 Computer Vision (Kris Kitani)

Carnegie Mellon University

slide-2
SLIDE 2

How do you find a corner?

Easily recognized by looking through a small window Shifting the window should give large change in intensity

[Moravec 1980]

slide-3
SLIDE 3

“edge”:
 no change along the edge direction “corner”:
 significant change in all directions “flat” region:
 no change in all directions

Easily recognized by looking through a small window Shifting the window should give large change in intensity

[Moravec 1980]

slide-4
SLIDE 4

Design a program to detect corners

(hint: use image gradients)

slide-5
SLIDE 5

Finding corners

(a.k.a. PCA)

1.Compute image gradients over small region 2.Subtract mean from each image gradient 3.Compute the covariance matrix 4.Compute eigenvectors and eigenvalues 5.Use threshold on eigenvalues to detect corners

Ix = ∂I ∂x

Iy = ∂I ∂y

2 4 P

p∈P

IxIx P

p∈P

IxIy P

p∈P

IyIx P

p∈P

IyIy 3 5

slide-6
SLIDE 6
  • 1. Compute image gradients over a small region

(not just a single pixel)

slide-7
SLIDE 7
  • 1. Compute image gradients over a small region

(not just a single pixel)

Ix = ∂I ∂x

Iy = ∂I ∂y

array of x gradients array of y gradients

slide-8
SLIDE 8

visualization of gradients

image X derivative Y derivative

slide-9
SLIDE 9

Ix = ∂I ∂x Ix = ∂I ∂x Ix = ∂I ∂x

Iy = ∂I ∂y Iy = ∂I ∂y Iy = ∂I ∂y

What does the distribution tell you about the region?

slide-10
SLIDE 10

Ix = ∂I ∂x Ix = ∂I ∂x Ix = ∂I ∂x

Iy = ∂I ∂y Iy = ∂I ∂y Iy = ∂I ∂y

distribution reveals edge orientation and magnitude

slide-11
SLIDE 11

Ix = ∂I ∂x Ix = ∂I ∂x Ix = ∂I ∂x

Iy = ∂I ∂y Iy = ∂I ∂y Iy = ∂I ∂y

How do you quantify orientation and magnitude?

slide-12
SLIDE 12
  • 2. Subtract the mean from each image gradient
slide-13
SLIDE 13
  • 2. Subtract the mean from each image gradient

plot intensities constant intensity gradient intensities along the line

slide-14
SLIDE 14
  • 2. Subtract the mean from each image gradient

plot intensities constant intensity gradient

Ix = ∂I ∂x

Iy = ∂I ∂y

intensities along the line plot of image gradients subtract mean

slide-15
SLIDE 15
  • 2. Subtract the mean from each image gradient

plot intensities constant intensity gradient

Ix = ∂I ∂x

Iy = ∂I ∂y

intensities along the line plot of image gradients

Ix = ∂I ∂x

Iy = ∂I ∂y

data is centered (‘DC’ offset is removed) subtract mean

slide-16
SLIDE 16
  • 3. Compute the covariance matrix
slide-17
SLIDE 17
  • 3. Compute the covariance matrix

Where does this covariance matrix come from?

2 4 P

p∈P

IxIx P

p∈P

IxIy P

p∈P

IyIx P

p∈P

IyIy 3 5

Ix = ∂I ∂x Iy = ∂I ∂y

array of x gradients array of y gradients

*. =sum( )

P

p∈P

IxIy P

slide-18
SLIDE 18

Error function

Change of intensity for the shift [u,v]:

Intensity Shifted intensity Window function

  • r

Window function w(x,y) = Gaussian 1 in window, 0 outside

Error function Some mathematical background…

slide-19
SLIDE 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

slide-20
SLIDE 20

Bilinear approximation

For small shifts [u,v] we have a ‘bilinear approximation’: where M is a 2×2 matrix computed from image derivatives:

Change in appearance for a shift [u,v]

M

‘second moment’ matrix ‘structure tensor’

slide-21
SLIDE 21

2 4 P

p∈P

IxIx P

p∈P

IxIy P

p∈P

IyIx P

p∈P

IyIy 3 5

By computing the gradient covariance matrix… we are fitting a quadratic to the gradients over a small image region

slide-22
SLIDE 22

Visualization of a quadratic

The surface E(u,v) is locally approximated by a quadratic form

slide-23
SLIDE 23

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

slide-24
SLIDE 24

flat edge ‘line’ corner ‘dot’

slide-25
SLIDE 25
  • 4. Compute eigenvalues and eigenvectors
slide-26
SLIDE 26

eig(M)

slide-27
SLIDE 27
  • 4. Compute eigenvalues and eigenvectors

eigenvector eigenvalue

Me = λe

(M − λI)e = 0

slide-28
SLIDE 28
  • 1. Compute the determinant of

(returns a polynomial)

eigenvector eigenvalue

M − λI

Me = λe

(M − λI)e = 0

  • 4. Compute eigenvalues and eigenvectors
slide-29
SLIDE 29
  • 1. Compute the determinant of

(returns a polynomial)

eigenvector eigenvalue

  • 2. Find the roots of polynomial

(returns eigenvalues) det(M − λI) = 0

M − λI

Me = λe

(M − λI)e = 0

  • 4. Compute eigenvalues and eigenvectors
slide-30
SLIDE 30
  • 1. Compute the determinant of

(returns a polynomial)

eigenvector eigenvalue

  • 2. Find the roots of polynomial

(returns eigenvalues) det(M − λI) = 0

M − λI

Me = λe

(M − λI)e = 0

  • 3. For each eigenvalue, solve

(returns eigenvectors)

(M − λI)e = 0

  • 4. Compute eigenvalues and eigenvectors
slide-31
SLIDE 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 slowest change direction of the fastest change

(λmax)-1/2 (λmin)-1/2

Ellipse equation:

slide-32
SLIDE 32

interpreting eigenvalues

λ1 λ2 λ2 >> λ1 λ1 >> λ2

λ1 ∼ 0 λ2 ∼ 0

What kind of image patch does each region represent?

slide-33
SLIDE 33

interpreting eigenvalues

‘horizontal’ edge ‘vertical’ edge flat corner

λ1 λ2 λ2 >> λ1 λ1 >> λ2

λ1 ~ λ2

slide-34
SLIDE 34

interpreting eigenvalues

‘horizontal’ edge ‘vertical’ edge flat corner

λ1 λ2 λ2 >> λ1 λ1 >> λ2

λ1 ~ λ2

slide-35
SLIDE 35
  • 5. Use threshold on eigenvalues to detect corners
slide-36
SLIDE 36

flat

λ1 λ2

  • 5. Use threshold on eigenvalues to detect corners

Think of a function to score ‘cornerness’

slide-37
SLIDE 37

flat

λ1 λ2

  • 5. Use threshold on eigenvalues to detect corners

Think of a function to score ‘cornerness’

strong corner

slide-38
SLIDE 38

flat corner

λ1 λ2

  • 5. Use threshold on eigenvalues to detect corners
  • ^

R = min(λ1, λ2)

Use the smallest eigenvalue as the response function

slide-39
SLIDE 39

flat corner

λ1 λ2

  • 5. Use threshold on eigenvalues to detect corners
  • ^

R = λ1λ2 − κ(λ1 + λ2)2

Eigenvalues need to be bigger than one.

Can compute this more efficiently…

slide-40
SLIDE 40

flat corner

λ1 λ2 R < 0 R > 0 R < 0

R ⌧ 0

R = det(M) − κtrace2(M)

  • 5. Use threshold on eigenvalues to detect corners
  • ^
slide-41
SLIDE 41

R = det(M) − κtrace2(M)

R = det(M) trace(M) +

Harris & Stephens (1988) Kanade & Tomasi (1994) Nobel (1998)

R = min(λ1, λ2)

slide-42
SLIDE 42
  • 1. Compute x and y derivatives of image
  • 2. Compute products of derivatives at every pixel
  • 3. Compute the sums of the products of derivatives at

each pixel

Harris Detector

C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988.

I G I

x x

∗ =

σ

I G I

y y

∗ =

σ x x x

I I I ⋅ =

2

y y y

I I I ⋅ =

2

y x xy

I I I ⋅ =

2 2

' x x

I G S ∗ =

σ

2 2

' y y

I G S ∗ =

σ xy xy

I G S ∗ =

' σ

slide-43
SLIDE 43

Harris Detector

C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988.

4. Define the matrix at each pixel 5. Compute the response of the detector at each pixel 6. Threshold on value of R; compute non-max suppression.

! ! " # $ $ % & = ) , ( ) , ( ) , ( ) , ( ) , (

2 2

y x S y x S y x S y x S y x M

y xy xy x

( )

2

trace det M k M R − =

slide-44
SLIDE 44
slide-45
SLIDE 45

Corner response

slide-46
SLIDE 46
slide-47
SLIDE 47

Thresholded corner response

slide-48
SLIDE 48

Non-maximal suppression

slide-49
SLIDE 49
slide-50
SLIDE 50

Harris corner response is rotation invariant

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

slide-51
SLIDE 51

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

x (image coordinate) threshold

R

x (image coordinate)

slide-52
SLIDE 52

The Harris detector not invariant to changes in …