Local features:Local features: detection and...

34
9/7/2012 1 Local features: Local features: detection and description Local invariant features – Detection of interest points • Harris corner detection • Scale invariant blob detection: LoG – Description of local patches • SIFT : Histograms of oriented gradients

Transcript of Local features:Local features: detection and...

Page 1: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

1

Local features:Local features:detection and description

Local invariant features

– Detection of interest points

• Harris corner detection

• Scale invariant blob detection: LoG

– Description of local patches

• SIFT : Histograms of oriented gradients

Page 2: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

2

Today

Local features: main components1) Detection: Identify the

interest points

2) Description:Extract vector feature descriptor surrounding each interest point.

],,[ )1()1(11 dxx x

3) Matching: Determine correspondence between descriptors in two views

],,[ )2()2(12 dxx x

Kristen Grauman

Page 3: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

3

Goal: interest operator repeatability

• We want to detect (at least some of) the same points in both images.

• Yet we have to be able to run the detection procedure independently per image.

No chance to find true matches!

Goal: descriptor distinctiveness

• We want to be able to reliably determine which point goes with which.

?• Must provide some invariance to geometric

and photometric differences between the two views.

Page 4: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

4

Local features: main components1) Detection: Identify the

interest points

2) Description:Extract vector feature descriptor surrounding each interest point.

3) Matching: Determine correspondence between descriptors in two views

Kristen Grauman

• What points would you choose?

Kristen Grauman

Page 5: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

5

Corners as distinctive interest points

We should easily recognize the point by looking through a small window

Shifting a window in any direction should give a large change in intensity

“edge”:no change along the edge direction

“corner”:significant change in all directions

“flat” region:no change in all directions

Slide credit: Alyosha Efros, Darya Frolova, Denis Simakov

yyyx

yxxx

IIII

IIIIyxwM ),(

Corners as distinctive interest points

yyyx

2 x 2 matrix of image derivatives (averaged in neighborhood of a point).

x

II x

y

II y

y

I

x

III yx

Notation:

Kristen Grauman

Page 6: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

6

First, consider an axis-aligned corner:

What does this matrix reveal?

2 0III

First, consider an axis-aligned corner:

What does this matrix reveal?

2

12 0

0

yyx

yxx

III

IIIM

This means dominant gradient directions align with x or y axis

Look for locations where both λ’s are large.

If either λ is close to 0, then this is not corner-like.

What if we have a corner that is not aligned with the image axes?

Page 7: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

7

What does this matrix reveal?

Since M is symmetric, we have TXXM

2

1

0

0

iii xMx

The eigenvalues of M reveal the amount of intensity change in the two principal orthogonal gradient directions in the window.

Corner response function

“flat” region1 and 2 are

ll

“edge”:1 >> 2

“corner”:1 and 2 are large, small;2 >> 11 ~ 2;

22121

'

(trace)det(

)(

MM

f

Page 8: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

8

Harris corner detector

1) Compute M matrix for each image window to1) Compute M matrix for each image window to get their cornerness scores.

2) Find points whose surrounding window gave large corner response (f> threshold)

3) Take the points of local maxima, i.e., perform non-maximum suppressionnon maximum suppression

Example of Harris application

Page 9: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

9

Compute corner response f

Example of Harris application

Example of Harris applicationFind points with large corner response: f > threshold

Page 10: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

10

Example of Harris applicationTake only the points of local maxima of f

Example of Harris application

Page 11: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

11

Example of Harris application

Kristen Grauman

Compute corner response at every pixel.

Example of Harris application

Kristen Grauman

Page 12: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

12

Example of Harris application

Kristen Grauman

Properties of the Harris corner detector

Rotation invariant? TXXM

2

1

0

0

Yes

Scale invariant?

Page 13: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

13

Properties of the Harris corner detector

Rotation invariant? Yes

Scale invariant? No

All points will be classified as edges

Corner !

Scale invariant interest points

How can we independently select interest points in each image, such that the detections are repeatable across different scales?

Kristen Grauman

Page 14: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

14

Automatic Scale SelectionHow to find corresponding patch sizes independently?

))(())(( IfIf

K. Grauman, B. Leibe

)),(( )),((11

xIfxIfmm iiii

Intuition: • Find scale that gives local maxima of some function

f in both position and scale.

Automatic Scale Selection

• Function responses for increasing scale (scale signature) 

K. Grauman, B. Leibe

)),((1

xIfmii

)),((1

xIfmii

Page 15: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

15

Automatic Scale Selection

• Function responses for increasing scale (scale signature) 

K. Grauman, B. Leibe

)),((1

xIfmii

)),((1

xIfmii

Automatic Scale Selection

• Function responses for increasing scale (scale signature) 

K. Grauman, B. Leibe

)),((1

xIfmii

)),((1

xIfmii

Page 16: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

16

Automatic Scale Selection

• Function responses for increasing scale (scale signature) 

K. Grauman, B. Leibe

)),((1

xIfmii

)),((1

xIfmii

Automatic Scale Selection

• Function responses for increasing scale (scale signature) 

K. Grauman, B. Leibe

)),((1

xIfmii

)),((1

xIfmii

Page 17: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

17

Automatic Scale Selection

• Function responses for increasing scale (scale signature) 

K. Grauman, B. Leibe

)),((1

xIfmii

)),((1

xIfmii

What can be the “signature” function?

Page 18: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

18

Blob detection in 2D

Laplacian of Gaussian: Circularly symmetric operator for blob detection in 2D

2

2

2

22

y

g

x

gg

Blob detection in 2D: scale selection

Laplacian-of-Gaussian = “blob” detector2

2

2

22

y

g

x

gg

filte

r sc

ales

f

img1 img2 img3Bastian Leibe

Page 19: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

19

Blob detection in 2D

We define the characteristic scale as the scale that produces peak of Laplacian response

characteristic scale

Slide credit: Lana Lazebnik

Example

Original image at ¾ the size

Kristen Grauman

Page 20: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

20

Original image at ¾ the size

Kristen Grauman

Kristen Grauman

Page 21: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

21

Kristen Grauman

Kristen Grauman

Page 22: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

22

Kristen Grauman

Kristen Grauman

Page 23: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

23

Scale invariant interest points

Interest points are local maxima in both position and scale.

)()( yyxx LL

scale

List of(x, y, σ)

Squared filter response mapsKristen Grauman

Scale-space blob detector: Example

Image credit: Lana Lazebnik

Page 24: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

24

We can approximate the Laplacian with a difference of Gaussians; more efficient to implement.

Technical detail

2 ( , , ) ( , , )xx yyL G x y G x y

( , , ) ( , , )DoG G x y k G x y

(Laplacian)

(Difference of Gaussians)

Local features: main components1) Detection: Identify the

interest points

2) Description:Extract vector feature descriptor surrounding each interest point.

],,[ )1()1(11 dxx x

3) Matching: Determine correspondence between descriptors in two views

],,[ )2()2(12 dxx x

Kristen Grauman

Page 25: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

25

Geometric transformations

e.g. scale, translation, rotation

Photometric transformations

Figure from T. Tuytelaars ECCV 2006 tutorial

Page 26: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

26

Raw patches as local descriptors

The simplest way to describe the neighborhood around an interestneighborhood around an interest point is to write down the list of intensities to form a feature vector.

But this is very sensitive to even small shifts, rotations.

SIFT descriptor [Lowe 2004]

• Use histograms to bin pixels within sub-patches according to their orientation.

0 2

Why subpatches?

Why does SIFT have some illumination invariance?

Kristen Grauman

Page 27: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

27

Making descriptor rotation invariant

CSE 576: Computer Vision

Image from Matthew Brown

• Rotate patch according to its dominant gradient orientation

• This puts the patches into a canonical orientation.

• Extraordinarily robust matching technique• Can handle changes in viewpoint

• Up to about 60 degree out of plane rotation

SIFT descriptor [Lowe 2004]

• Can handle significant 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

Steve Seitz

Page 28: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

28

Example

NASA Mars Rover images

Example

NASA Mars Rover imageswith SIFT feature matchesFigure by Noah Snavely

Page 29: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

29

SIFT properties

• Invariant to

Scale– Scale

– Rotation

• Partially invariant to

– Illumination changes

– Camera viewpointCamera viewpoint

– Occlusion, clutter

Local features: main components1) Detection: Identify the

interest points

2) Description:Extract vector feature descriptor surrounding each interest point.

3) Matching: Determine correspondence between descriptors in two views

Kristen Grauman

Page 30: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

30

Matching local features

Kristen Grauman

Matching local features

?

Image 1 Image 2

To generate candidate matches, find patches that have the most similar appearance (e.g., lowest SSD)

Simplest approach: compare them all, take the closest (or closest k, or within a thresholded distance)

Image 1 Image 2

Kristen Grauman

Page 31: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

31

Ambiguous matches

Image 1 Image 2

? ? ? ?

At what SSD value do we have a good match?

To add robustness to matching, can consider ratio : distance to best match / distance to second best match

If low, first match looks good.

If high, could be ambiguous match.

Image 1 Image 2

Kristen Grauman

Matching SIFT Descriptors

• Nearest neighbor (Euclidean distance)

• Threshold ratio of nearest to 2nd nearest descriptor

Lowe IJCV 2004

Page 32: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

32

Applications of local invariant features

• Wide baseline stereoMotion tracking• Motion tracking

• Panoramas• Mobile robot navigation• 3D reconstruction• Recognition• …

Automatic mosaicing

http://www.cs.ubc.ca/~mbrown/autostitch/autostitch.html

Page 33: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

33

Wide baseline stereo

[Image from T. Tuytelaars ECCV 2006 tutorial]

Recognition of specific objects, scenes

Schmid and Mohr 1997 Sivic and Zisserman, 2003

Rothganger et al. 2003 Lowe 2002

Kristen Grauman

Page 34: Local features:Local features: detection and descriptioncv-fall2012/slides/fall2012_02_localfeats.pdf · “edge”: no change along the edge direction “corner”: significant change

9/7/2012

34

Summary

• Interest point detection– Harris corner detector

– Laplacian of Gaussian, automatic scale selection

• Invariant descriptors– Rotation according to dominant gradient direction

– Histograms for robustness to small shifts and translations (SIFT descriptor)