You are on page 1of 47

CNG 483

Introduction to Computer Vision

Interest Point Detection

Asst. Prof. Dr. Meryem Erbilek

Slide partially based on Stanford U. CS131

METU Lecture 6 - 1 CENG 483


What we will learn today?
• Local invariant features
– Motivation
– Requirements, invariances
• Keypoint localization
– Harris corner detector

Some background reading:


Richard Szeliski, Computer Vision: Algorithms and Applications, Chp.4.1
David Lowe, IJCV 2004

Slide partially based on Stanford U. CS131

METU Lecture 6 - 2 CENG 483


Image matching:
a challenging problem

Slide partially based on Stanford U. CS131

METU Lecture 6 - 3 CENG 483


Image matching:
a challenging problem

Slide credit: Steve Seitz


by Diva Sian

by swashford
Slide partially based on Stanford U. CS131

METU Lecture 6 - 4 CENG 483


Harder Case

Slide credit: Steve Seitz


by Diva Sian by scgbt

Slide partially based on Stanford U. CS131

METU Lecture 6 - 5 CENG 483


Harder Still?

Slide credit: Steve Seitz


NASA Mars Rover images
Slide partially based on Stanford U. CS131

METU Lecture 6 - 6 CENG 483


Answer Below (Look for tiny colored squares)

Slide credit: Steve Seitz


NASA Mars Rover images with SIFT feature matches
(Figure by Noah Snavely)
Slide partially based on Stanford U. CS131

METU Lecture 6 - 7 CENG 483


Motivation for using local features
• Global representations have major limitations
• Instead, describe and match only local regions
• Increased robustness to
– Occlusions

– Articulation

– Intra-category variations

Slide partially based on Stanford U. CS131

METU Lecture 6 - 8 CENG 483


General Approach
1. Find a set of
distinctive key-
points
A1 2. Define a region
around each
keypoint
A2 A3
3. Extract and
normalize the
region content

Slide credit: Bastian Leibe


Similarity
measure 4. Compute a local
descriptor from the
N pixels

normalized region
e.g. color e.g. color

N pixels 5. Match local


descriptors
Slide partially based on Stanford U. CS131

METU Lecture 6 - 9 CENG 483


Common Requirements
• Problem 1:
– Detect the same point independently in both images

Slide credit: Darya Frolova, Denis Simakov


No chance to match!

We need a repeatable detector!

Slide partially based on Stanford U. CS131

METU Lecture 6 - 10 CENG 483


Common Requirements
• Problem 1:
– Detect the same point independently in both images
• Problem 2:
– For each point correctly recognize the corresponding one

Slide credit: Darya Frolova, Denis Simakov


?

We need a reliable and distinctive descriptor!

Slide partially based on Stanford U. CS131

METU Lecture 6 - 11 CENG 483


Requirements
• Region extraction needs to be repeatable and accurate
– Invariant to translation, rotation, scale changes
– Robust or covariant to out-of-plane (≈affine) transformations
– Robust to lighting variations, noise, blur, quantization

• Locality: Features are local, therefore robust to occlusion


and clutter.
• Distinctiveness: The regions should contain “interesting”
structure.

Slide credit: Bastian Leibe


• Efficiency: Close to real-time performance.
• Quantity: We need a sufficient number of regions to cover the
object.

Slide partially based on Stanford U. CS131

METU Lecture 6 - 12 CENG 483


Requirements

Slide credit: Silvio Savarese


Slide partially based on Stanford U. CS131

METU Lecture 6 - 13 CENG 483


Requirements

Slide credit: Silvio Savarese


Slide partially based on Stanford U. CS131

METU Lecture 6 - 14 CENG 483


Many Existing Detectors Available
• Hessian & Harris [Beaudet ‘78], [Harris ‘88]
• Laplacian, DoG [Lindeberg ‘98], [Lowe ‘99]
• Harris-/Hessian-Laplace [Mikolajczyk & Schmid ‘01]
• Harris-/Hessian-Affine [Mikolajczyk & Schmid ‘04]
• EBR and IBR [Tuytelaars & Van Gool ‘04]
• MSER [Matas ‘02]
• Salient Regions [Kadir & Brady ‘01]
• Others…

Slide credit: Bastian Leibe


• Those detectors have become a basic building block for
many pre-deep learning approaches in Computer Vision.
• They are still very relevant & powerful tools

Slide partially based on Stanford U. CS131

METU Lecture 6 - 15 CENG 483


What we will learn today?
• Local invariant features
– Motivation
– Requirements, invariances
• Keypoint localization
– Harris corner detector

Slide partially based on Stanford U. CS131

METU Lecture 6 - 16 CENG 483


Keypoint Localization

• Goals:

Slide credit: Bastian Leibe


– Repeatable detection
– Precise localization
– Interesting content
⇒ Look for two-dimensional signal changes

Slide partially based on Stanford U. CS131

METU Lecture 6 - 17 CENG 483


Finding Corners

• Key property:
– In the region around a corner, image gradient has two or

Slide credit: Svetlana Lazebnik


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, 1988.
Slide partially based on Stanford U. CS131

METU Lecture 6 - 18 CENG 483


Corners as Distinctive Interest Points
• Design criteria
– We should easily recognize the point by looking through a
small window (locality)
– Shifting the window in any direction should give a large
change in intensity (good localization)

Slide credit: Alyosha Efros


“flat” region: “edge”: “corner”:
no change in all no change along significant change
directions the edge direction in all directions
Slide partially based on Stanford U. CS131

METU Lecture 6 - 19 CENG 483


Corners versus edges
Large
Corner
Large

Small
Edge
Large

Small
Nothing
Small

Slide partially based on Stanford U. CS131

METU Lecture 6 - 20 CENG 483


Corners versus edges
??
Corner
??

Slide partially based on Stanford U. CS131

METU Lecture 6 - 21 CENG 483


Harris Detector Formulation
• Consider shifting the window W by (u,v):
– How do the pixels in W change?
– Auto-correlation function measures
the self similarity of a signal and is W
related to the sum-of-squared
difference.
– Compare each pixel before and
after the shift by summing up the
squared differences (SSD).
– This defines an SSD “error” of E(u,v):
SSD for (u,v) direction
ofSlide
a single
partially region
based on Stanford U. CS131 Slide partially from Selim Aksoy
METU Lecture 6 - 22 CENG 483
Harris Detector Formulation
• Change of intensity for the shift [u,v]:

Window Shifted Intensity


function intensity

Slide credit: Rick Szeliski


Window function w(x,y) = o
r
1 in window, 0 outside Gaussian
Slide partially based on Stanford U. CS131

METU Lecture 6 - 23 CENG 483


Harris Detector Formulation
• Taylor Series expansion of I:

• If the motion (u,v) is assumed to be small, then first


order approximation is good.

• Plugging this into the formula on the previous slide...


Slide partially based on Stanford U. CS131 Slide partially from Selim Aksoy
METU Lecture 6 - 24 CENG 483
Harris Detector Formulation
• Sum-of-squared differences error E(u,v):

Slide partially based on Stanford U. CS131 Slide partially from Selim Aksoy
METU Lecture 6 - 25 CENG 483
Harris Detector Formulation
• This can be rewritten:

• For the example above:


– You can move the center of the green window to anywhere on the blue
unit circle.
– Which directions will result in the largest and smallest E values?

Slide partially based on Stanford U. CS131 Slide partially from Selim Aksoy
METU Lecture 6 - 26 CENG 483
Harris Detector Formulation
• This measure of change can be further simplified as:

where H is a 2×2 matrix computed from image derivatives:

Gradient with
respect to x,
times gradient
Slide credit: Rick Szeliski

Sum over image region – the area we are


with respect to y
checking for corner

Slide partially based on Stanford U. CS131

METU Lecture 6 - 27 CENG 483


Harris Detector Formulation

Image I Ix Iy IxIy
Slide credit: Rick Szeliski

Slide partially based on Stanford U. CS131

METU Lecture 6 - 28 CENG 483


Harris Detector Formulation

• E(u,v) is an equation of an ellipse, where M is the covariance


matrix.
• Let 1 and 2 be eigenvalues of M.

• Reminder:

Slide partially based on Stanford U. CS131

METU Lecture 6 - 29 CENG 483


Harris Detector Formulation
• Interpreting the Eigenvalues
• 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
Slide credit: Kristen Grauman

λ1 and λ2 are small;


E is almost constant in “Flat”
all directions “Edge”
region λ1 >> λ2
λ1
Slide partially based on Stanford U. CS131

METU Lecture 6 - 30 CENG 483


Harris Detector Formulation
• To measure the corner strength:
R = det(H) – k(trace(H))2
where
trace(H) = λ1 + λ2
det(H) = λ1 x λ2
(λ1 and λ2 are the eigenvalues of H).
• R is positive for corners, negative in edge regions, and small in
flat regions.

Slide partially based on Stanford U. CS131 Slide partially from Selim Aksoy
METU Lecture 6 -
Corner Response Function

λ2 “Edge”
θ<0
“Corner”
θ>0
Slide credit: Kristen Grauman

• Fast approximation
– Avoid computing the
eigenvalues
– α: constant
(0.04 to 0.06) “Flat” “Edge”
region θ<0
λ1
Slide partially based on Stanford U. CS131

METU Lecture 6 - 32 CENG 483


Window Function w(x,y)

• Option 1: uniform window


– Sum over square window

– Problem: not rotation invariant 1 in window, 0 outside

• Option 2: Smooth with Gaussian

Slide credit: Bastian Leibe


– Gaussian already performs weighted sum

– Result is rotation invariant Gaussian

Slide partially based on Stanford U. CS131

METU Lecture 6 - 33 CENG 483


Summary: Harris Detector [Harris88]
• Compute second moment matrix
(autocorrelation matrix)
Ix Iy
1. Image
derivatives

2. Square of Ix2 Iy2 IxIy


derivatives
Slide credit: Krystian Mikolajczyk

3. Gaussian
filter g(σI)
g(Ix2) g(Iy2) g(IxIy)
4. Cornerness function – two strong eigenvalues

5. Perform non-maximum suppression


Slide partially based on Stanford U. CS131 R
METU Lecture 6 - 34 CENG 483
Algorithm: Harris Detector

Slide partially based on Stanford U. CS131

METU Lecture 6 - 35
Harris detector example

Slide partially based on Stanford U. CS131 Slide partially from Selim Aksoy
METU Lecture 6 -
Harris detector example
Corner responses R

R values (red high, blue low)


Slide partially based on Stanford U. CS131 Slide partially from Selim Aksoy
METU Lecture 6 -
Harris detector example
Thresholding

Threshold (R > value)


Slide partially based on Stanford U. CS131 Slide partially from Selim Aksoy
METU Lecture 6 -
Harris detector example
Non maximum suppression

Local maxima of R
Slide partially based on Stanford U. CS131 Slide partially from Selim Aksoy
METU Lecture 6 - 39
Harris detector example

Harris features (red)


Slide partially based on Stanford U. CS131 Slide partially from Selim Aksoy
METU Lecture 6 - 40
Harris Detector – Responses [Harris88]

Slide credit: Krystian Mikolajczyk


Effect: A very precise
corner detector.

Slide partially based on Stanford U. CS131

METU Lecture 6 - 41 CENG 483


Harris Detector – Responses [Harris88]

Slide credit: Krystian Mikolajczyk


Slide partially based on Stanford U. CS131

METU Lecture 6 - 42 CENG 483


Harris Detector – Responses [Harris88]

Slide credit: Kristen Grauman


• Results are well suited for finding stereo correspondences
Slide partially based on Stanford U. CS131

METU Lecture 6 - 43 CENG 483


Harris Detector: Properties

• Translation invariance?

Slide credit: Kristen Grauman


Slide partially based on Stanford U. CS131

METU Lecture 6 - 44 CENG 483


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


Slide partially based on Stanford U. CS131

METU Lecture 6 - 45 CENG 483


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!
Slide partially based on Stanford U. CS131

METU Lecture 6 - 46 CENG 483


What we learned so far?
• Local invariant features
– Motivation
– Requirements, invariances
• Keypoint localization
– Harris corner detector

Slide partially based on Stanford U. CS131

METU Lecture 6 - 47 CENG 483

You might also like