Top Banner
Harris Corner Detector & Scale Invariant Feature Transform (SIFT)
72

Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Dec 13, 2015

Download

Documents

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: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Corner Detector&

Scale Invariant Feature Transform (SIFT)

Page 2: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Corner Detector

Page 3: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Detector: Intuition

“flat” region:no change in all directions

“edge”:no change along the edge direction

“corner”:significant change in all directions

Page 4: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Moravec Corner Detector

• Shift in any direction would result in a significant change at a corner.

Algorithm:•Shift in horizontal, vertical, and diagonal directions by one pixel.•Calculate the absolute value of the MSE for each shift. •Take the minimum as the cornerness response.

Page 5: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Detector: Mathematics

2

,

( , ) ( , ) ( , ) ( , )x y

E u v w x y I x u y v I x y

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

IntensityShifted

intensityWindow function

orWindow function w(x,y) =

Gaussian1 in window, 0 outside

Page 6: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Detector: MathematicsApply Taylor series expansion:

yxyx

yxy

yxx

yxIyxIyxwC

yxIyxwB

yxIyxwA

BvCuvAuvuE

,

,

2

,

2

22

),(),(),(

),(),(

),(),(

2),(

( , )A C u

E u v u vC B v

Page 7: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Detector: Mathematics

( , ) ,u

E u v u v Mv

For small shifts [u,v] we have the following approximation:

2

2,

( , ) x x y

x y x y y

I I IM w x y

I I I

where M is a 22 matrix computed from image derivatives:

Page 8: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Detector: Mathematics

( , ) ,u

E u v u v Mv

Intensity change in shifting window: eigenvalue analysis

1, 2 – eigenvalues of M

direction of the slowest change

direction of the fastest change

(max)-1/2

(min)-1/2

Ellipse E(u,v) = const

Page 9: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Detector: Mathematics

1

2

“Corner”1 and 2 are large,

1 ~ 2;

E increases in all directions

1 and 2 are small;

E is almost constant in all directions

“Edge” 1 >> 2

“Edge” 2 >> 1

“Flat” region

Classification of image points using eigenvalues of M:

Page 10: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris corner detector

Measure of corner response:

2det traceR M k M

1 2

1 2

det

trace

M

M

(k – empirical constant, k = 0.04-0.06)

No need to compute eigenvalues explicitly!

Page 11: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)
Page 12: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)
Page 13: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Eliminate small responses.

Page 14: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Find local maxima of the remaining.

Page 15: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)
Page 16: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Detector: Scale

Rmin= 0

Rmin= 1500

Page 17: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Summary of the Harris detector

Page 18: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Detector: Some Properties

• Rotation invariance

Ellipse rotates but its shape (i.e. eigenvalues) remains the same

Corner response R is invariant to image rotation

Page 19: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Detector: Some Properties

• 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)

Page 20: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Detector: Some Properties

• But: non-invariant to image scale!

All points will be classified as edges

Corner !

Page 21: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris Detector: Some Properties

• Quality of Harris detector for different scale changes

Repeatability rate:

# correspondences# possible correspondences

C.Schmid et.al. “Evaluation of Interest Point Detectors”. IJCV 2000

Page 22: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Scale Invariant Detection

• Consider regions (e.g. circles) of different sizes around a point

• Regions of corresponding sizes will look the same in both images

Page 23: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Scale Invariant Detection

• The problem: how do we choose corresponding circles independently in each image?

Page 24: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Scale Invariant Detection• Solution:

– Design a function on the region (circle), which is “scale invariant” (the same for corresponding regions, even if they are at different scales)

Example: average intensity. For corresponding regions (even of different sizes) it will be the same.

scale = 1/2

– For a point in one image, we can consider it as a function of region size (circle radius)

f

region size

Image 1 f

region size

Image 2

Page 25: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Scale Invariant Detection• Common approach:

scale = 1/2

f

region size

Image 1 f

region size

Image 2

Take a local maximum of this function

Observation: region size, for which the maximum is achieved, should be invariant to image scale.

s1 s2

Page 26: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Characteristic Scale

Ratio of scales corresponds to a scale factor between two images

Page 27: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Scale Invariant Detection• A “good” function for scale detection:

has one stable sharp peak

f

region size

bad

f

region size

bad

f

region size

Good !

• For usual images: a good function would be a one which responds to contrast (sharp local intensity change)

Page 28: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Scale Invariant Detection• Functions for determining scale

2 2

21 22

( , , )x y

G x y e

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

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

Kernel Imagef Kernels:

where Gaussian

(Laplacian)

(Difference of Gaussians)

L or DoG kernel is a matching filter. It finds blob-like structure. It turns out to be also successful in getting characteristic scale of other structures, such as corner regions.

Page 29: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Difference-of-Gaussians

IkG * IGkGD *

IG *

IkG *2

Page 30: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Scale-Space Extrema

• Choose all extrema within 3x3x3 neighborhood.

D

kD

2kD

X is selected if it is larger or smaller than all 26 neighbors

Page 31: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Scale Invariant Detectors• Harris-Laplacian1

Find local maximum of:– Harris corner detector in

space (image coordinates)– Laplacian in scale

1 K.Mikolajczyk, C.Schmid. “Indexing Based on Scale Invariant Interest Points”. ICCV 20012 D.Lowe. “Distinctive Image Features from Scale-Invariant Keypoints”. Accepted to IJCV 2004

scale

x

y

Harris

L

apla

cian

• SIFT (Lowe)2

Find local maximum of:– Difference of Gaussians in

space and scale

scale

x

y

DoG

D

oG

Page 32: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Harris-Laplace Detector

Page 33: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Scale Invariant Detectors

K.Mikolajczyk, C.Schmid. “Indexing Based on Scale Invariant Interest Points”. ICCV 2001

• Experimental evaluation of detectors w.r.t. scale change

Repeatability rate:

# correspondences# possible correspondences

Page 34: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Affine Invariant Detection

• Above we considered:Similarity transform (rotation + uniform scale)

• Now we go on to:Affine transform (rotation + non-uniform scale)

Page 35: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Affine Invariant Detection

• Take a local intensity extremum as initial point• Go along every ray starting from this point and stop

when extremum of function f is reached

T.Tuytelaars, L.V.Gool. “Wide Baseline Stereo Matching Based on Local, Affinely Invariant Regions”. BMVC 2000.

0

10

( )( )

( )t

o

t

I t If t

I t I dt

f

points along the ray

Page 36: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Affine Invariant Detection

• Such extrema occur at positions where intensity suddenly changes compared to the intensity changes up to that point.

• In theory, leaving out the denominator would still give invariant positions. In practice, the local extrema would be shallow, and might result in inaccurate positions.

T.Tuytelaars, L.V.Gool. “Wide Baseline Stereo Matching Based on Local, Affinely Invariant Regions”. BMVC 2000.

0

10

( )( )

( )t

o

t

I t If t

I t I dt

Page 37: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Affine Invariant Detection

• The regions found may not exactly correspond, so we approximate them with ellipses

• Find the ellipse that best fits the region

Page 38: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Affine Invariant Detection

q Ap

2 1TA A

12 1Tq q

2 region 2

Tqq

• Covariance matrix of region points defines an ellipse:

11 1Tp p

1 region 1

Tpp

( p = [x, y]T is relative to the center of mass)

Ellipses, computed for corresponding regions, also correspond!

Page 39: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Affine Invariant Detection

• Algorithm summary (detection of affine invariant region):– Start from a local intensity extremum point– Go in every direction until the point of extremum of

some function f– Curve connecting the points is the region boundary– Compute the covariance matrix– Replace the region with ellipse

T.Tuytelaars, L.V.Gool. “Wide Baseline Stereo Matching Based on Local, Affinely Invariant Regions”. BMVC 2000.

Page 40: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Affine Invariant Detection• Maximally Stable Extremal

Regions– Threshold image intensities: I > I0

– Extract connected components(“Extremal Regions”)

– Find “Maximally Stable” regions– Approximate a region with

an ellipse

J.Matas et.al. “Distinguished Regions for Wide-baseline Stereo”. Research Report of CMP, 2001.

Page 41: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Affine Invariant Detection : Summary

• Under affine transformation, we do not know in advance shapes of the corresponding regions

• Ellipse given by geometric covariance matrix of a region robustly approximates this region

• For corresponding regions ellipses also correspond

Methods:

1. Search for extremum along rays [Tuytelaars, Van Gool]:

2. Maximally Stable Extremal Regions [Matas et.al.]

Page 42: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Point Descriptors• We know how to detect points• Next question: How to match them?

?

Point descriptor should be:1. Invariant2. Distinctive

Page 43: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Descriptors Invariant to Rotation

• Convert from Cartesian to Polar coordinates• Rotation becomes translation in polar

coordinates• Take Fourier Transform

– Magnitude of the Fourier transform is invariant to translation.

Page 44: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Descriptors Invariant to Rotation

• Find local orientationDominant direction of gradient

• Compute image regions relative to this orientation

Page 45: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Descriptors Invariant to Scale• Use the characteristic scale determined by

detector to compute descriptor in a normalized frame

Page 46: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Affine Invariant Descriptors• Find affine normalized frame

J.Matas et.al. “Rotational Invariants for Wide-baseline Stereo”. Research Report of CMP, 2003

2Tqq

1Tpp

A

A11

1 1 1TA A A2

12 2 2

TA A

rotation

• Compute rotational invariant descriptor in this normalized frame

Page 47: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Affine covariant regions

Page 48: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

SIFT (Scale Invariant Feature Transform)

Page 49: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

SIFT – Scale Invariant Feature Transform1

• Empirically found2 to show very good performance, invariant to image rotation, scale, intensity change, and to moderate affine transformations

1 D.Lowe. “Distinctive Image Features from Scale-Invariant Keypoints”. Accepted to IJCV 20042 K.Mikolajczyk, C.Schmid. “A Performance Evaluation of Local Descriptors”. CVPR 2003

Scale = 2.5Rotation = 450

Page 50: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

SIFT – Scale Invariant Feature Transform

• Descriptor overview:– Determine scale (by maximizing DoG in scale and in space),

local orientation as the dominant gradient direction.Use this scale and orientation to make all further computations invariant to scale and rotation.

– Compute gradient orientation histograms of several small windows (to produce 128 values for each point)

D.Lowe. “Distinctive Image Features from Scale-Invariant Keypoints”. Accepted to IJCV 2004

Page 51: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Scale-space extrema detection

• Need to find “characteristic scale” for each feature point.

Page 52: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Difference-of-Gaussians

IkG * IGkGD *

IG *

IkG *2

Page 53: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Scale-Space Extrema

• Choose all extrema within 3x3x3 neighborhood.

D

kD

2kD

X is selected if it is larger or smaller than all 26 neighbors

Page 54: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Keypoint Localization & Filtering

• Now we have much less points than pixels.

• However, still lots of points (~1000s)…– With only pixel-accuracy at best– And this includes many bad points

Brown & Lowe 2002

Page 55: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Keypoint Filtering - Low Contrast

• Reject points with bad contrast:– DoG smaller than 0.03 (image values in [0,1])

• Reject edges– Similar to the Harris detector; look at the

autocorrelation matrix

Page 56: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Maxima in D

Page 57: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Remove low contrast and edges

Page 58: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Orientation assignment

• By assigning a consistent orientation, the keypoint descriptor can be orientation invariant.

• Let, for a keypoint, L is the image with the closest scale.– Compute gradient magnitude and orientation using finite

differences:

( 1, ) ( 1, )

( , 1) ( , 1)

L x y L x yGradientVector

L x y L x y

Page 59: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Orientation assignment

Page 60: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Orientation assignment

Page 61: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Orientation assignment

Page 62: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Orientation assignment

Page 63: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Orientation Assignment

• Any peak within 80% of the highest peak is used to create a keypoint with that orientation

• ~15% assigned multiplied orientations, but contribute significantly to the stability

Page 64: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

SIFT descriptor

Page 65: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

SIFT Descriptor

• Each point so far has x, y, σ, m, θ

• Now we need a descriptor for the region– Could sample intensities around point, but…

• Sensitive to lighting changes• Sensitive to slight errors in x, y, θ

Edelman et al. 1997

Page 66: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

SIFT Descriptor• 16x16 Gradient window is taken. Partitioned into 4x4 subwindows.• Histogram of 4x4 samples in 8 directions• Gaussian weighting around center( is 0.5 times that of the scale of

a keypoint)• 4x4x8 = 128 dimensional feature vector

Image from: Jonas Hurrelmann

Page 67: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Performance

• Very robust– 80% Repeatability at:

• 10% image noise• 45° viewing angle• 1k-100k keypoints in database

• Best descriptor in [Mikolajczyk & Schmid 2005]’s extensive survey

Page 68: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)
Page 69: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)
Page 70: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)
Page 71: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)

Recognition under occlusion

Page 72: Harris Corner Detector & Scale Invariant Feature Transform (SIFT)