0% found this document useful (0 votes)
11 views

Lec5. Keypoint Detection

E (u, v) ≈   v   x, y x, y x y     w( x, y ) I ( x, y) I ( x, y)  w( x, y) I2 ( x, y)  y

Uploaded by

nguyễn Đức
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Lec5. Keypoint Detection

E (u, v) ≈   v   x, y x, y x y     w( x, y ) I ( x, y) I ( x, y)  w( x, y) I2 ( x, y)  y

Uploaded by

nguyễn Đức
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

Keypoint Detection

Image matching

by Diva Sian

by swashford
Harder case

by Diva Sian by scgbt


Harder still?

NASA Mars Rover images


Answer below (look for tiny colored squares…)

NASA Mars Rover images


with SIFT feature matches
Figure by Noah Snavely
Local features and alignment

• We need to match (align) images


• Global methods sensitive to occlusion, lighting, parallax
effects. So look for local features that match well.
• How would you do it by eye?

[Darya Frolova and Denis Simakov]


Local features and alignment
• Detect feature points in both images

[Darya Frolova and Denis Simakov]


Local features and alignment
• Detect feature points in both images
• Find corresponding pairs

[Darya Frolova and Denis Simakov]


Local features and alignment
• Detect feature points in both images
• Find corresponding pairs
• Use these pairs to align images

[Darya Frolova and Denis Simakov]


Local features and alignment
• Problem 1:
– Detect the same point independently in both
images

no chance to match!

We need a repeatable detector

[Darya Frolova and Denis Simakov]


Local features and alignment
• Problem 2:
– For each point correctly recognize the
corresponding one

We need a reliable and distinctive descriptor

[Darya Frolova and Denis Simakov]


Geometric transformations
Photometric transformations

Figure from T. Tuytelaars ECCV 2006 tutorial


And other nuisances…
• Noise
• Blur
• Compression artifacts
• …
Invariant local features
Subset of local feature types designed to be invariant to
common geometric and photometric transformations.

Basic steps:
1) Detect distinctive interest points
2) Extract invariant descriptors

Figure: David Lowe


Main questions
• Where will the interest points come from?
– What are salient features that we’ll detect in
multiple views?
• How to describe a local region?
• How to establish correspondences, i.e.,
compute matches?
Finding Corners

Key property: in the region around a corner,


image gradient has two or more dominant
directions
Corners are repeatable and distinctive

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


Proceedings of the 4th Alvey Vision Conference: pages 147--151.

Source: Lana Lazebnik


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

“flat” region: “edge”: “corner”:


no change in no change significant
all directions along the edge change in all
Source: A. Efros
direction directions
Harris Detector formulation

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

E (u , v) =  w( x, y )  I ( x + u , y + v) − I ( x, y ) 
2

x, y

Window Shifted Intensity


function intensity

Window function w(x,y) = or

1 in window, 0 outside Gaussian

Source: R. Szeliski
Corner Detection by Auto-correlation
Change in appearance of window w(x,y) for shift [u,v]:

E (u, v) =  w( x, y)  I ( x + u, y + v) − I ( x, y) 
2

x, y

I(x, y)
E(u, v)

E(0,0)

w(x, y)
Corner Detection by Auto-correlation
Change in appearance of window w(x,y) for shift [u,v]:

E (u, v) =  w( x, y)  I ( x + u, y + v) − I ( x, y) 
2

x, y

I(x, y)
E(u, v)

E(3,2)

w(x, y)
E (u, v) =  w( x, y)  I ( x + u, y + v) − I ( x, y) 
2

x, y

Think-Pair-Share:
Correspond the three
red crosses to (b,c,d).

As a surface
Corner Detection by Auto-correlation

Change in appearance of window w(x,y) for shift [u,v]:

E (u, v) =  w( x, y)  I ( x + u, y + v) − I ( x, y) 
2

x, y

We want to discover how E behaves for small shifts

But this is very slow to compute naively.


O(window_width2 * shift_range2 * image_width2)

O( 112 * 112 * 6002 ) = 5.2 billion of these


Corner Detection by Auto-correlation

Change in appearance of window w(x,y) for shift [u,v]:

E (u, v) =  w( x, y)  I ( x + u, y + v) − I ( x, y) 
2

x, y

We want to discover how E behaves for small shifts

But we know the response in E that we are looking


for – strong peak.
Can we just approximate E(u,v) locally
by a quadratic surface?


Recall: Taylor series expansion
A function f can be represented by an infinite series
of its derivatives at a single point a:

Wikipedia

As we care about window


centered, we set a = 0
(MacLaurin series)

Approximation of
f(x) = ex
centered at f(0)
Local quadratic approximation of E(u,v) in the
neighborhood of (0,0) is given by the
second-order Taylor expansion:

 Eu (0,0) 1  Euu (0,0) Euv (0,0) u 


E (u, v)  E (0,0) + [u v]  + [u v]  v 
 v
E ( 0,0)  2  uv
E ( 0,0) Evv ( 0,0)  

Notation: partial derivative


Local quadratic approximation of E(u,v) in the
neighborhood of (0,0) is given by the
second-order Taylor expansion:

 Eu (0,0) 1  Euu (0,0) Euv (0,0) u 


E (u, v)  E (0,0) + [u v]  + [u v]  v 
 v
E ( 0,0)  2  uv
E ( 0,0) Evv ( 0,0)  

Ignore function
value; set to 0 Ignore first Just look at
derivative, shape of
set to 0 second
derivative
Corner Detection: Mathematics
E (u, v) =  w( x, y)  I ( x + u, y + v) − I ( x, y) 
2

x, y

Second-order Taylor expansion of E(u,v) about (0,0):


 Eu (0,0) 1  Euu (0,0) Euv (0,0) u 
E (u, v)  E (0,0) + [u v]  + [u v]  v 
 v
E ( 0,0)  2  uv
E ( 0,0) Evv ( 0,0)  
Eu (u, v) =  2 w( x, y )I ( x + u , y + v) − I ( x, y )I x ( x + u , y + v)
x, y

Euu (u, v) =  2 w( x, y )I x ( x + u, y + v) I x ( x + u, y + v)
x, y

+  2w( x, y )I ( x + u, y + v) − I ( x, y )I xx ( x + u , y + v)


x, y

Euv (u, v) =  2 w( x, y )I y ( x + u , y + v) I x ( x + u , y + v)
x, y

+  2w( x, y )I ( x + u, y + v) − I ( x, y )I xy ( x + u, y + v)


x, y
Corner Detection: Mathematics
E (u, v) =  w( x, y)  I ( x + u, y + v) − I ( x, y) 
2

x, y

Second-order Taylor expansion of E(u,v) about (0,0):


 Eu (0,0) 1  Euu (0,0) Euv (0,0) u 
E (u, v)  E (0,0) + [u v]  + [u v]  v 
 v
E ( 0,0)  2  uv
E ( 0,0) Evv ( 0,0)  
E (0,0) = 0
Eu (0,0) = 0
Ev (0,0) = 0
Euu (0,0) =  2 w( x, y )I x ( x, y ) I x ( x, y )
x, y

E vv (0,0) =  2 w( x, y )I y ( x, y ) I y ( x, y )
x, y

Euv (0,0) =  2 w( x, y )I x ( x, y ) I y ( x, y )
x, y
Corner Detection: Mathematics
E (u, v) =  w( x, y)  I ( x + u, y + v) − I ( x, y) 
2

x, y

Second-order Taylor expansion of E(u,v) about (0,0):




 w( x, y ) I x2 ( x, y )  w( x, y) I ( x, y) I ( x, y) u 
x y
E (u, v)  [u v] x, y x, y


 x , y
w( x, y ) I x ( x, y ) I y ( x, y )  w( x, y) I ( x, y)  v 
2
y
x, y 
E (0,0) = 0
Eu (0,0) = 0
Ev (0,0) = 0
Euu (0,0) =  2 w( x, y )I x ( x, y ) I x ( x, y )
x, y

E vv (0,0) =  2 w( x, y )I y ( x, y ) I y ( x, y )
x, y

Euv (0,0) =  2 w( x, y )I x ( x, y ) I y ( x, y )
x, y
Corner Detection: Mathematics
The quadratic approximation simplifies to

 Euu (0,0) Euv (0,0) u  u 


E (u , v)  [u v]  v  E (u , v)  [u v] M  
 uv
E ( 0,0) E vv ( 0,0)   v 

where M is a second moment matrix computed from image


derivatives:

 I x2 IxI y 
M =  w( x, y )  2 
x, y  I x I y I y 

M
Corners as distinctive interest points

I x I x IxIy 
M =  w( x, y )  
I
 y x I IyIy 

2 x 2 matrix of image derivatives


(averaged in neighborhood of a point)

I I I I
Notation: Ix  Iy  IxI y 
x y x y
James Hays
Interpreting the second moment matrix
The surface E(u,v) is locally approximated by a
quadratic form. Let’s try to understand its shape.

u 
E (u , v)  [u v] M  
v 

 I x2 IxI y 
M =  w( x, y )  2 
x, y  I x I y I y 

James Hays
Interpreting the second moment matrix
u 
Consider a horizontal “slice” of E(u, v): [u v] M   = const
v 
This is the equation of an ellipse.

James Hays
Interpreting the second moment matrix

First, consider the axis-aligned case


(gradients are either horizontal or vertical)

 I x2 I x I y  1 0 
M =  w( x, y )  2 
= 
x, y  I x I y I y   0 2 

If either λ is close to 0, then this is not a corner, so


look for locations where both are large.
Interpreting the second moment matrix
u 
Consider a horizontal “slice” of E(u, v): [u v] M   = const
v 
This is the equation of an ellipse.
1 0 
−1
Diagonalization of M: M =R   R
 0 2 
The axis lengths of the ellipse are determined by the eigenvalues,
and the orientation is determined by a rotation matrix 𝑅.
direction of the
fastest change
direction of the
slowest change

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

James Hays
Classification of image points using eigenvalues of M

2 “Edge”
2 >> 1 “Corner”
1 and 2 are large,
1 ~ 2;
E increases in all
directions

1 and 2 are small;


E is almost constant “Flat” “Edge”
in all directions region 1 >> 2

1
Classification of image points using eigenvalues of M

Cornerness
2 “Edge”
C = 12 −  (1 + 2 ) 2
C<0 “Corner”
α: constant (0.04 to 0.06) C>0

|C| small
“Flat” “Edge”
region C<0

1
Classification of image points using eigenvalues of M

Cornerness
2 “Edge”
C = 12 −  (1 + 2 ) 2
C<0 “Corner”
α: constant (0.04 to 0.06) C>0

Remember your linear algebra:


Determinant:

Trace:
|C| small
“Flat” “Edge”
C = det( M ) −  trace( M ) 2 region C<0

1
Harris corner detector

1) Compute M matrix for each window to recover


a cornerness score 𝐶.
• Note: We can find M purely from the per-pixel image derivatives!
2) Threshold to find pixels which give large corner
response (𝐶 > threshold).
3) Find the local maxima pixels,
i.e., suppress non-maxima.

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


Proceedings of the 4th Alvey Vision Conference: pages 147—151, 1988.
James Hays
Harris Corner Detector [Harris88]
0. Input image
We want to compute M at each pixel.
𝐼
1. Compute image derivatives (optionally, blur first).

𝐼𝑥 𝐼𝑦
2. Compute 𝑀 components
as squares of derivatives.
𝐼𝑥2 𝐼𝑦2 𝐼𝑥𝑦
3. Gaussian filter g() with width s

𝑔(𝐼𝑥2 ) 𝑔(𝐼𝑦2) 𝑔(𝐼𝑥 ∘ 𝐼𝑦)

4. Compute cornerness
2
𝐶 = det 𝑀 − 𝛼 trace 𝑀
2
= 𝑔 𝐼𝑥2 ∘ 𝑔 𝐼𝑦2 − 𝑔 𝐼𝑥 ∘ 𝐼𝑦
2
−𝛼 𝑔 𝐼𝑥2 +𝑔 𝐼𝑦2
𝑅 5. Threshold on 𝐶 to pick high cornerness
6. Non-maxima suppression to pick peaks.
Harris Detector: Steps
Harris Detector: Steps
Compute corner response 𝐶
Harris Detector: Steps
Find points with large corner response: 𝐶 > threshold
Harris Detector: Steps
Take only the points of local maxima of 𝐶
Harris Detector: Steps
Harris Detector: Properties

• Translation invariance?

Slide credit: Kristen Grauman


Lecture 6 - 49 12-Oct-17
Harris Detector: Properties

• Translation invariance
• Rotation invariance?

Slide credit: Kristen Grauman


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

Corner response θ is invariant to image rotation

Lecture 6 - 50 12-Oct-17
Harris Detector: Properties

• Translation invariance
• Rotation invariance
• Scale invariance?

Slide credit: Kristen Grauman


Corner All points will be
classified as edges!
Not invariant to image scale!

Lecture 6 - 51 12-Oct-17
• How can we detect scale invariant
interest points?
How to cope with transformations?
• Exhaustive search
• Invariance
• Robustness
Exhaustive search
• Multi-scale approach

Slide from T. Tuytelaars ECCV 2006 tutorial


Exhaustive search
• Multi-scale approach
Exhaustive search
• Multi-scale approach
Exhaustive search
• Multi-scale approach
Invariance
• Extract patch from each image individually
Automatic scale selection
• Solution:
– Design a function on the region, 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.
– For a point in one image, we can consider it as
a function of region size (patch width)

f Image 1 f Image 2
scale = 1/2

region size region size


Automatic scale selection
• Common approach:
Take a local maximum of this function

Observation: region size, for which the maximum is


achieved, should be invariant to image scale.

Important: this scale invariant region size is


found in each image independently!

f Image 1 f Image 2
scale = 1/2

s1 region size s2 region size


Automatic Scale Selection
Augmented Computing
SensoryTutorial
Recognition

f ( I i1im ( x, s )) = f ( I i1im ( x, s ))


Objectand

Same operator responses if the patch contains the same image up


Perceptual

to scale factor.
Visual

61
K. Grauman, B. Leibe
Automatic Scale Selection
• Function responses for increasing scale (scale signature)
Objectand
Perceptual
Visual Augmented Computing
SensoryTutorial
Recognition

f ( I i1im ( x, s )) f ( I i1im ( x, s ))


62
K. Grauman, B. Leibe
Automatic Scale Selection
• Function responses for increasing scale (scale signature)
Objectand
Perceptual
Visual Augmented Computing
SensoryTutorial
Recognition

f ( I i1im ( x, s )) f ( I i1im ( x, s ))


63
K. Grauman, B. Leibe
Automatic Scale Selection
• Function responses for increasing scale (scale signature)
Objectand
Perceptual
Visual Augmented Computing
SensoryTutorial
Recognition

f ( I i1im ( x, s )) f ( I i1im ( x, s ))


64
K. Grauman, B. Leibe
Automatic Scale Selection
• Function responses for increasing scale (scale signature)
Objectand
Perceptual
Visual Augmented Computing
SensoryTutorial
Recognition

f ( I i1im ( x, s )) f ( I i1im ( x, s ))


65
K. Grauman, B. Leibe
Automatic Scale Selection
• Function responses for increasing scale (scale signature)
Objectand
Perceptual
Visual Augmented Computing
SensoryTutorial
Recognition

f ( I i1im ( x, s )) f ( I i1im ( x, s ))


66
K. Grauman, B. Leibe
Automatic Scale Selection
• Function responses for increasing scale (scale signature)
Objectand
Perceptual
Visual Augmented Computing
SensoryTutorial
Recognition

f ( I i1im ( x, s )) f ( I i1im ( x, s ))


67
K. Grauman, B. Leibe
Scale Invariant Detection
• A “good” function for scale detection:
has one stable sharp peak
f f f
Good
bad bad !
region size region size region size

• For usual images: a good function would be one


which responds to contrast (sharp local intensity
change)

Lecture 7 - 68 17-Oct-17
What Is A Useful Signature Function f ?
• Functions for determining scale f = Kernel  Image
Kernels:

L = s 2 ( Gxx ( x, y, s ) + Gyy ( x, y, s ) )
(Laplacian)

DoG = G ( x, y, ks ) − G ( x, y, s )
(Difference of Gaussians)

where Gaussian

x2 + y 2
− Note: both kernels are invariant
G( x, y, s ) = 1
2s
e 2s 2
to scale and rotation

Lecture 7 - 69 17-Oct-17
What Is A Useful Signature Function?
• Laplacian-of-Gaussian = “blob” detector
Objectand
Perceptual
Visual Augmented Computing
SensoryTutorial
Recognition

70
K. Grauman, B. Leibe
Characteristic scale
We define the characteristic scale as the scale
that produces peak of Laplacian response

characteristic scale
T. Lindeberg (1998). "Feature detection with automatic scale selection."
International Journal of Computer Vision 30 (2): pp 77--116. Source: Lana Lazebnik
Laplacian-of-Gaussian (LoG)
• Interest points:
s5
Local maxima in scale
space of Laplacian-of-
Augmented Computing

Gaussian s4

Lxx (s ) + Lyy (s ) s3
SensoryTutorial
Recognition

s2

 List of
Objectand

s (x, y, σ)
Perceptual
Visual

K. Grauman, B. Leibe
Scale-space blob detector: Example

Source: Lana Lazebnik


Scale-space blob detector: Example

Source: Lana Lazebnik


Scale-space blob detector: Example

Source: Lana Lazebnik


Alternative approach
Approximate LoG with Difference-of-Gaussian (DoG).

Ruye Wang
Alternative approach
Approximate LoG with Difference-of-Gaussian (DoG).

1. Blur image with σ Gaussian kernel


2. Blur image with kσ Gaussian kernel
3. Subtract 2. from 1.

- =

K. Grauman, B. Leibe
Find local maxima in position-scale space of DoG

Find maxima

ks …
2ks
- =
s
 List of
- ks = (x, y, s)

- =
s
Input image
K. Grauman, B. Leibe
Example of keypoint detection

(a) 233x189 image


(b) 832 DOG extrema
(c) 729 left after peak
value threshold
(d) 536 left after testing
ratio of principle
curvatures (removing
edge responses)
Scale Invariant Detection: Summary

• Given: two images of the same scene with a


large scale difference between them
• Goal: find the same interest points
independently in each image
• Solution: search for maxima of suitable
functions in scale and in space (over the
image)

You might also like