detecting corners16385/s18/lectures/lecture5.pdfharris detector c.harris and m.stephens. “a...

131
Detecting corners 16-385 Computer Vision Spring 2018, Lecture 5 http://www.cs.cmu.edu/~16385/

Upload: others

Post on 04-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Detecting corners

16-385 Computer VisionSpring 2018, Lecture 5http://www.cs.cmu.edu/~16385/

Page 2: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Course announcements

• Homework 0 and homework 1 are available on course website.- Homework 1 is due on February 7th.- Any questions about the homeworks?- How many of you have looked at/started/finished homework 0?- How many of you have looked at/started/finished homework 1?

• There was a small correction to homework 1.- Posted on Piazza.- Make sure to download the latest version.

Page 3: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Leftover from Lecture 4:

• Hough circles.

New in lecture 5:

• Why detect corners?

• Visualizing quadratics.

• Harris corner detector.

• Multi-scale detection.

• Multi-scale blob detection.

Overview of today’s lecture

Page 4: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Slide credits

Most of these slides were adapted from:

• Kris Kitani (15-463, Fall 2016).

Some slides were inspired or taken from:

• Fredo Durand (MIT).• James Hays (Georgia Tech).

Page 5: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Why detect corners?

Page 6: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Why detect corners?

Image alignment (homography, fundamental matrix)

3D reconstruction

Motion tracking

Object recognition

Indexing and database retrieval

Robot navigation

Page 7: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Planar object instance recognition

Database of planar objects Instance recognition

Page 8: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

3D object recognitionDatabase of 3D objects 3D objects recognition

Page 9: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Recognition under occlusion

Page 10: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Location Recognition

Page 11: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Robot Localization

Page 12: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Image matching

Page 13: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

NASA Mars Rover images

Where are the corresponding points?

Page 14: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 15: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Pick a point in the image.

Find it again in the next image.

What type of feature would you select?

Page 16: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Pick a point in the image.

Find it again in the next image.

What type of feature would you select?

Page 17: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Pick a point in the image.

Find it again in the next image.

What type of feature would you select?

a corner

Page 18: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Visualizing quadratics

Page 19: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Equation of a circle

Equation of a ‘bowl’ (paraboloid)

If you slice the bowl at

what do you get?

Page 20: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Equation of a circle

Equation of a ‘bowl’ (paraboloid)

If you slice the bowl at

what do you get?

Page 21: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

can be written in matrix form like this…

Page 22: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

‘sliced at 1’

Page 23: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

What happens if you increase

coefficient on x?

and slice at 1

Page 24: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

What happens if you increase

coefficient on x?

and slice at 1

decrease width in x!

Page 25: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

What happens if you increase

coefficient on x?

and slice at 1

decrease width in x!

What happens to the gradient in x?

increases gradient in x

‘thins the bowl in x’

Page 26: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

What happens if you increase

coefficient on y?

and slice at 1

Page 27: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

What happens if you increase

coefficient on y?

and slice at 1

decrease width in y

Page 28: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

What happens if you increase

coefficient on y?

and slice at 1

decrease width in y

What happens to the gradient in y?

Page 29: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

What happens if you increase

coefficient on y?

and slice at 1

decrease width in y

What happens to the gradient in y?

increases gradient in y

‘thins the bowl in y’

Page 30: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

can be written in matrix form like this…

What’s the shape?

What are the eigenvectors?

What are the eigenvalues?

Page 31: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

can be written in matrix form like this…

eigenvalues

along diagonaleigenvectors

Result of Singular Value Decomposition (SVD)

axis of the ‘ellipse

slice’

gradient of the

quadratic along

the axis

Page 32: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

EigenvaluesEigenvectors

Eig

en

ve

cto

rs

Eigenvector

Eig

en

ve

cto

r

*not the size of the axis

Page 33: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

you can smash this bowl in the y direction

you can smash this bowl in the x direction

Recall:

Page 34: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Eigenvalues

Eigenvectors Eigenvectors

Eigenvector

Eig

en

ve

cto

r

*not the size of the axis

(inverse relation)

Page 35: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Eigenvalues

Eigenvectors Eigenvectors

Page 36: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Eigenvalues

Eigenvectors Eigenvectors

Page 37: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Error function for Harris Corners

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

We will need this to understand the…

Page 38: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Harris corner detector

Page 39: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

How do you find a corner?

Page 40: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

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]

Page 41: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

“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]

Page 42: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

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

Page 43: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

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

Page 44: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

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

Page 45: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

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

array of x gradients

array of y gradients

Page 46: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

visualization of gradients

image

X derivative

Y derivative

Page 47: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

What does the distribution tell you about the region?

Page 48: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

distribution reveals edge orientation and magnitude

Page 49: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

How do you quantify orientation and magnitude?

Page 50: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

2. Subtract the mean from each image gradient

Page 51: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

2. Subtract the mean from each image gradient

plot intensities

constant intensity

gradient

intensities along the line

Page 52: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

2. Subtract the mean from each image gradient

plot intensities

constant intensity

gradient

intensities along the line

plot of image gradients

subtract mean

Page 53: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

2. Subtract the mean from each image gradient

plot intensities

constant intensity

gradient

intensities along the line

plot of image gradientsdata is centered

(‘DC’ offset is removed)

subtract mean

Page 54: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

3. Compute the covariance matrix

Page 55: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

3. Compute the covariance matrix

Where does this covariance matrix come from?

array of x gradients array of y gradients

.*=sum( )

Page 56: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

“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]

Page 57: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Error function

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

IntensityShifted

intensity

Window

function

orWindow function w(x,y) =

Gaussian1 in window, 0 outside

Error

function

Some mathematical background…

Page 58: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Error function approximation

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

First-order Taylor expansion of I(x,y) about (0,0)

(bilinear approximation for small shifts)

Page 59: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

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’

Page 60: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

By computing the gradient covariance matrix…

we are fitting a quadratic to the gradients over a

small image region

Page 61: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Visualization of a quadratic

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

Page 62: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Which error surface indicates a good image feature?

What kind of image patch do these surfaces represent?

Page 63: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Which error surface indicates a good image feature?

flat

Page 64: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Which error surface indicates a good image feature?

flat edge

‘line’

Page 65: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

flat edge

‘line’

corner

‘dot’

Which error surface indicates a good image feature?

Page 66: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

4. Compute eigenvalues and eigenvectors

Page 67: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

4. Compute eigenvalues and eigenvectors

eigenvector

eigenvalue

Page 68: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

1. Compute the determinant of(returns a polynomial)

eigenvector

eigenvalue

4. Compute eigenvalues and eigenvectors

Page 69: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

1. Compute the determinant of(returns a polynomial)

eigenvector

eigenvalue

2. Find the roots of polynomial(returns eigenvalues)

4. Compute eigenvalues and eigenvectors

Page 70: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

1. Compute the determinant of(returns a polynomial)

eigenvector

eigenvalue

2. Find the roots of polynomial(returns eigenvalues)

3. For each eigenvalue, solve(returns eigenvectors)

4. Compute eigenvalues and eigenvectors

Page 71: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

eig(M)

Page 72: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

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

(lmax)-1/2

(lmin)-1/2

Ellipse equation:

Page 73: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

interpreting eigenvalues

l1

l2

l2 >> l1

l1 >> l2

What kind of image patch does

each region represent?

Page 74: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

interpreting eigenvalues

‘horizontal’

edge

‘vertical’

edge

flat

corner

l1

l2

l2 >> l1

l1 >> l2

l1 ~ l2

Page 75: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

interpreting eigenvalues

‘horizontal’

edge

‘vertical’

edge

flat

corner

l1

l2

l2 >> l1

l1 >> l2

l1 ~ l2

Page 76: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

interpreting eigenvalues

‘horizontal’

edge

‘vertical’

edge

flat

corner

l1

l2

l2 >> l1

l1 >> l2

l1 ~ l2

Page 77: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

5. Use threshold on eigenvalues to detect corners

Page 78: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

flat

l1

l2

5. Use threshold on eigenvalues to detect corners

Think of a function to

score ‘cornerness’

Page 79: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

flat

l1

l2

5. Use threshold on eigenvalues to detect corners

Think of a function to

score ‘cornerness’

strong corner

Page 80: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

flat

corner

l1

l2

5. Use threshold on eigenvalues to detect corners

(a function of )^

Use the smallest eigenvalue as

the response function

Page 81: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

flat

corner

l1

l2

5. Use threshold on eigenvalues to detect corners

(a function of )^

Eigenvalues need to be

bigger than one.

Can compute this more efficiently…

Page 82: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

flat

corner

l1

l2

R < 0 R > 0

R < 0

5. Use threshold on eigenvalues to detect corners

(a function of )^

Page 83: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Harris & Stephens (1988)

Kanade & Tomasi (1994)

Nobel (1998)

Page 84: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

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 DetectorC.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988.

Page 85: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Harris DetectorC.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.

Page 86: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Yet another option:

How do you write this equivalently

using determinant and trace?

Page 87: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Yet another option:

Page 88: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Harris criterion

Different criteria

Page 89: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 90: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Corner response

Page 91: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 92: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Thresholded corner response

Page 93: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Non-maximal suppression

Page 94: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 95: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Harris corner response is

invariant to rotation

Ellipse rotates but its shape

(eigenvalues) remains the same

Corner response R is invariant to image rotation

Page 96: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

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)

Harris corner response is

invariant to intensity changes

Page 97: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

The Harris detector is not invariant to changes in …

Page 98: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

The Harris corner detector is not

invariant to scale

edge!corner!

Page 99: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Multi-scale detection

Page 100: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

How can we make a feature detector scale-invariant?

Page 101: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

How can we automatically select the scale?

Page 102: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Multi-scale blob detection

Page 103: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 104: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Find local maxima in both position and scale

f

region size

Image 1f

region size

Image 2

s1 s2

Intuitively…

Page 105: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Highest response when the signal has the

same characteristic scale as the filter

Laplacian filter

Formally…

Page 106: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

characteristic scale

characteristic scale - the scale that

produces peak filter response

we need to search over characteristic scales

Page 107: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Full size 3/4 size

What happens if you apply different Laplacian filters?

Page 108: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

jet color scale

blue: low, red: high

Page 109: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 110: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 111: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 112: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 113: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 114: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Full size 3/4 size

What happened when you applied different Laplacian filters?

Page 115: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 116: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 117: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

peak!

Page 118: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

peak!

Page 119: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 120: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 121: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Full size 3/4 size

What happened when you applied different Laplacian filters?

Page 122: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

2.1 4.2 6.0

9.8 15.5 17.0

peak!

Page 123: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

2.1 4.2 6.0

9.8 15.5 17.0

maximum response

Page 124: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

optimal scale2.1 4.2 6.0 9.8 15.5 17.0

Full size image

2.1 4.2 6.0 9.8 15.5 17.0

3/4 size image

Page 125: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

optimal scale2.1 4.2 6.0 9.8 15.5 17.0

Full size image

2.1 4.2 6.0 9.8 15.5 17.0

3/4 size image

maximum

response

maximum

response

Page 126: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

cross-scale maximum

local maximum

local maximum

local maximum

4.2

6.0

9.8

Page 127: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

How would you implement

scale selection?

Page 128: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

implementation

For each level of the Gaussian pyramid

compute feature response (e.g. Harris, Laplacian)

For each level of the Gaussian pyramid

if local maximum and cross-scale

save scale and location of feature

Page 129: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 130: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute
Page 131: Detecting corners16385/s18/lectures/lecture5.pdfHarris Detector C.Harris and M.Stephens. “A Combined Corner and Edge Detector.”1988. 4. Define the matrix at each pixel 5. Compute

Basic reading:• Szeliski textbook, Sections 4.1.

References