Top Banner
Image Features All is Vanity, by C. Allan Gilbert, 1873-1929
71

Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Aug 08, 2018

Download

Documents

phamhuong
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Image Features

All is Vanity, by C. Allan Gilbert, 1873-1929

Page 2: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature extraction: Corners and blobs

• c

Page 3: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Motivation: Automatic

Credit: Matt Brown

Page 4: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Why extract features?• Motivation: panorama stitching

– We have two images – how do we combine them?

Page 5: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Why extract features?• Motivation: panorama stitching

– We have two images – how do we combine them?

Step 1: extract featuresStep 2: match features

Page 6: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Why extract features?• Motivation: panorama stitching

– We have two images – how do we combine them?

Step 1: extract featuresStep 2: match featuresStep 3: align images

Page 7: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Harder still?

NASA Mars Rover images

Page 8: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

NASA Mars Rover images with SIFT feature matchesFigure by Noah Snavely

Answer below (look for tiny colored squares…)

Page 9: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

More motivation… Feature points are used for:

• Image alignment (e.g., panoramas) • 3D reconstruction • Motion tracking • Object recognition • Indexing and database retrieval • Robot navigation • … many others

Page 10: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Challenges: Invariance

Find features that are invariant to transformations • geometric invariance: translation, rotation, scale • photometric invariance: brightness, exposure, …

Page 11: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Two Problems for FeaturesFeature detection

Page 12: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Two Problems for FeaturesFeature detection Feature descriptor

Page 13: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Two Problems for FeaturesFeature detection Feature descriptor

Page 14: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

What makes a good feature?

Zoom-in demo

Page 15: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Want uniquenessLook for unusual image regions

• Lead to unambiguous matches in other images

How to define “unusual”?

Page 16: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Local measures of uniquenessConsider a small window of pixels

• Where are features good and bad?

Slide adapted from Darya Frolova, Denis Simakov, Weizmann Institute.

Page 17: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Local measures of uniquenessConsider a small window of pixels

• Where are features good and bad?

Slide adapted from Darya Frolova, Denis Simakov, Weizmann Institute.

Page 18: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature detection

“flat” region:no change in all directions

“edge”: no change along the edge direction

“corner”:significant change in all directions

Uniqueness =How does it change when shifted by a small amount?

Slide adapted from Darya Frolova, Denis Simakov, Weizmann Institute.

Page 19: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature detectionDefine E(u,v) = amount of change when you shift the window by (u,v)

E(u,v) is small for all shifts

E(u,v) is small for some shifts

E(u,v) is small for no shifts

We want to be ______

Page 20: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Consider shifting the window W by (u,v) • how do the pixels in W change? • compare each pixel before and after by

Sum of the Squared Differences (SSD) • this defines an SSD “error” E(u,v):

Feature detection: the math

W

Page 21: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Taylor Series expansion of I:

If the motion (u,v) is small, then first order approx is good

Plugging this into the formula on the previous slide…

Small motion assumption

Page 22: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Consider shifting the window W by (u,v) • how do the pixels in W change? • compare each pixel before and after by

summing up the squared differences • this defines an “error” of E(u,v):

Feature detection: the math

W

Page 23: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature detection: the mathThis can be rewritten:

Page 24: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature detection: the mathThis can be rewritten:

Which [u v] maximizes E(u,v)?

Which [u v] minimizes E(u,v)?

Page 25: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature detection: the mathThis can be rewritten:

Which [u v] maximizes E(u,v)?

Which [u v] minimizes E(u,v)?

Page 26: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature detection: the mathThis can be rewritten:

x-

x+

Eigenvector with the largest eigen value?

Eigenvector with the smallest eigen value? x-

x+

Page 27: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Quick eigenvalue/eigenvector reviewThe eigenvectors of a matrix A are the vectors x that satisfy:

The scalar λ is the eigenvalue corresponding to x • The eigenvalues are found by solving:

• In our case, A = H is a 2x2 matrix, so we have

• The solution:

Page 28: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature detectionLocal measure of feature uniqueness

• E(u,v) = amount of change when you shift the window by (u,v)

E(u,v) is small for all shifts

E(u,v) is small for some shifts

E(u,v) is small for no shifts

We want to be large

=

Page 29: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Eigenvalues of H

? ?

Page 30: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Eigenvalues of H

Page 31: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature detection summaryHere’s what you do • Compute the gradient at each point in the image • Create the H matrix from the entries in the gradient • Compute the eigenvalues. • Find points with large response (λ- > threshold)

• Choose those points where λ- is a local maximum as features

Page 32: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature detection summaryHere’s what you do • Compute the gradient at each point in the image • Create the H matrix from the entries in the gradient • Compute the eigenvalues. • Find points with large response (λ- > threshold)

• Choose those points where λ- is a local maximum as features

Called “non-local max suppression”

Page 33: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

The Harris operatorλ- is a variant of the “Harris operator” for feature detection

0.03 0.02f

Flat

Page 34: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

The Harris operatorλ- is a variant of the “Harris operator” for feature detection

0.03 0.02 0.012f

Flat

Page 35: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

The Harris operatorλ- is a variant of the “Harris operator” for feature detection

0.03 0.02 0.012

3 0.02 0.02

fFlat?

Page 36: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

The Harris operatorλ- is a variant of the “Harris operator” for feature detection

0.03 0.02 0.012

3 0.02 0.02

fFlatEdge

Page 37: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

The Harris operatorλ- is a variant of the “Harris operator” for feature detection

0.03 0.02 0.012

3 0.02 0.02

2.5 3 1.36

fFlatEdge?

Page 38: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

The Harris operatorλ- is a variant of the “Harris operator” for feature detection

0.03 0.02 0.012

3 0.02 0.02

2.5 3 1.36

fFlatEdgeCorner

Page 39: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

The Harris operatorλ- is a variant of the “Harris operator” for feature detection

0.03 0.02 0.012

3 0.02 0.02

2.5 3 1.36

5 6 2.73

fFlatEdgeCorner?

Page 40: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

The Harris operatorλ- is a variant of the “Harris operator” for feature detection

0.03 0.02 0.012

3 0.02 0.02

2.5 3 1.36

5 6 2.73

fFlatEdgeCornerStrong corner

Page 41: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

The Harris operatorλ- is a variant of the “Harris operator” for feature detection

• The trace is the sum of the diagonals, i.e., trace(H) = h11 + h22

• Very similar to λ- but less expensive (no square root) • Called the “Harris Corner Detector” or “Harris Operator” • Lots of other detectors, this is one of the most popular

Page 42: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

The Harris operator

Harris operator

Page 43: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Harris detector example

Page 44: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

f value (red high, blue low)

Page 45: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Threshold (f > value)

Page 46: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Find local maxima of f

Page 47: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Harris features (in red)

Page 48: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

InvarianceSuppose you rotate the image by some angle

Will you still pick up the same features? What if you change the brightness? Scale?

Page 49: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Scale invariant detectionSuppose you’re looking for corners

Key idea: find scale that gives local maximum of f • f is a local maximum in both position and scale

Page 50: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Slide from Tinne Tuytelaars

Lindeberg et al, 1996

Slide from Tinne Tuytelaars

Lindeberg et al., 1996

Page 51: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor
Page 52: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor
Page 53: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor
Page 54: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor
Page 55: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor
Page 56: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor
Page 57: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Two Problems for FeaturesFeature detection Feature descriptor

Page 58: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature descriptorsWe know how to detect good points Next question: How to match them?

?

Page 59: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Feature descriptorsWe know how to detect good points Next question: How to match them?

Lots of possibilities (this is a popular research area) • Simple option: Sum of squared differences • State of the art approach: SIFT

– David Lowe, UBC http://www.cs.ubc.ca/~lowe/keypoints/

?

Page 60: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

The most popular descriptor• SIFT

60

Page 61: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Scale Invariant Feature Transform

Histograms of gradient directions over spatial regions

Page 62: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Basic idea: • Take 16x16 square window around detected feature • Compute edge orientation (angle of the gradient - 90°) for each pixel • Throw out weak edges (threshold gradient magnitude) • Create histogram of surviving edge orientations

Scale Invariant Feature Transform

Adapted from slide by David Lowe

0 2πangle histogram

Page 63: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

SIFT descriptorFull version • Divide the 16x16 window into a 4x4 grid of cells (2x2 case shown below) • Compute an orientation histogram for each cell • 16 cells * 8 orientations = 128 dimensional descriptor

Adapted from slide by David Lowe

Page 64: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Properties of SIFTExtraordinarily robust matching technique

• Handle viewpoint changes – Up to about 60 degree out of plane rotation

• Handle significant illumination changes in illumination – Sometimes even day vs. night (below)

• Fast and efficient—can run in real time • Lots of code available

– http://people.csail.mit.edu/albert/ladypack/wiki/index.php/Known_implementations_of_SIFT

Page 65: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Invariance (for descriptors)Compare two images I1 and I2

• I2 may be a transformed version of I1

• What kinds of transformations are likely in practice?

Page 66: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Invariance (for descriptors)Compare two images I1 and I2

• I2 may be a transformed version of I1

• What kinds of transformations are likely in practice?

In practice – Limited 3D rotations (up to about 60 degrees) – Limited affine transformations (some are fully affine invariant) – Limited illumination/contrast changes

Page 67: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Find dominant orientation • This is given by x+, the eigenvector of H corresponding to λ+

– λ+ is the larger eigenvalue

• Rotate the window according to this angle

Rotation invariance

Figure by Matthew Brown

Page 68: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Scale Invariance• Automatic scale selection • Detect at multiple scales

68

Page 69: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Scale Invariance• Automatic scale selection • Detect at multiple scales

69

Page 70: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

Scale Invariance• Automatic scale selection • Detect at multiple scales

70

Page 71: Image Features - cs.sfu.cafurukawa/cmpt469-888/slides/19.features.pdf · with SIFT feature matches ... • Lots of other detectors, this is one of the most popular. ... SIFT descriptor

71

Next feature matching…