Digital Image Processing
Digital Image Processing
PROCESSING
Lecture 9
Features detection and matching
Tammy Riklin Raviv
Electrical and Computer Engineering
Ben-Gurion University of the Negev
Feature detection and matching – Why?
Image stitching
3
Image Stitching
• Feature description
• Feature matching
• Feature tracking
Feature detection and matching
• Feature detection (extraction)
• each image is searched for locations that are likely to
match well in other images.
• Feature description
• Feature matching
• Feature tracking
Feature detection and matching
• Feature detection (extraction)
• Feature description
• each region around detected keypoint locations is
converted into a more compact and stable (invariant)
descriptor that can be matched against other
descriptors.
• Feature matching
• Feature tracking
Feature detection and matching
• Feature detection (extraction)
• Feature description
• Feature matching
• efficiently searches for likely matching candidates in
other images.
• Feature tracking
Feature detection and matching
• Feature detection (extraction)
• Feature description
• Feature matching
• Feature tracking
• alternative to the third stage that only searches a small
neighborhood around each detected feature and is therefore more
suitable for video processing.
Feature detection and matching
• Feature detection (extraction)
• each image is searched for locations that are likely to match
well in other images.
• Feature description
• each region around detected keypoint locations is converted
into a more compact and stable (invariant) descriptor that
can be matched against other descriptors.
• Feature matching
• efficiently searches for likely matching candidates in
other images.
• Feature tracking
• alternative to the third stage that only searches a small
neighborhood around each detected feature and is
therefore more suitable for video processing.
What are good key-points (patches)?
Comparing two image patches
displacement vector
+
Auto-correlation surfaces
+
Auto-correlation surfaces
+
Auto-correlation surfaces
Using a Taylor Series expansion of the image function
Ix Iy
Harr=
Cornerness – Harris Corner
Fei-Fei Li
Example: Harris Corner
Adaptive non-maximal suppression
(ANMS, Brown, Szeliski, and Winder 2005)
11/19/2019 32
Implementation Concern:
How do you rotate a patch?
• Start with an “empty” patch whose dominant direction is
“up”.
• For each pixel in your patch, compute the position in the
detected image patch. It will be in floating point and will
fall between the image pixels.
• Interpolate the values of the 4 closest pixels in the image,
to get a value for the pixel in your patch.
36
Rotating a Patch
(x,y) T
(x’,y’)
I01 I11
y
I00 I10
x
11/19/2019 38
SIFT: Motivation
• The Harris operator is not invariant to scale and
correlation is not invariant to rotation1.
• For better image matching, Lowe’s goal was to
develop an interest operator that is invariant to scale
and rotation.
1But Schmid and Mohr developed a rotation invariant descriptor for it in 1997.
11/19/2019 39
Idea of SIFT
• Image content is transformed into local feature
coordinates that are invariant to translation, rotation,
scale, and other imaging parameters
SIFT Features
11/19/2019 40
2. Keypoint localization
Fit a model to detrmine location and scale.
Select keypoints based on a measure of stability.
3. Orientation assignment
Compute best orientation(s) for each keypoint region.
4. Keypoint description
Use local image gradients at selected scale and rotation
to describe each keypoint region.
11/19/2019 42
mean
G 1/8
G 1/4
Gaussian 1/2
11/19/2019 47
• Hence
s+2 filters
s+1=2(s+1)/s0
.
.
i=2i/s0
.
. s+3 s+2
2=22/s0 images differ-
1=21/s0 including ence
0 original images
The parameter s determines the number of images per octave.
11/19/2019 51
Blur
Subtract
% correctly matched
Stability Expense
• Sampling in scale for efficiency
• How many scales should be used per octave? S=?
• More scales evaluated, more keypoints found
• S < 3, stable keypoints increased too
• S > 3, stable keypoints decreased
• S = 3, maximum stable keypoints found
11/19/2019 53
2. Keypoint localization
832
233x189
initial keypoints
536
729
keypoints after keypoints after
gradient threshold ratio threshold
3. Rotation Invariance and orientation
estimation
If 2 major orientations, use both.
Affine region detectors used to match two images taken from dramatically
different viewpoints (Mikolajczyk and Schmid 2004)
11/19/2019 58
4. Keypoint Descriptors
• At this point, each keypoint has
• location
• scale
• orientation
• Next is to compute a descriptor for the local image region
about each keypoint that is
• highly distinctive
• invariant as possible to variations such as changes in viewpoint
and illumination
SIFT
MOPS descriptors are formed using an 8 x8 sampling of bias and gain normalized
intensity values, with a sample spacing of five pixels relative to the detection scale.
This low frequency sampling gives the features some robustness to interest point
location error and is achieved by sampling at a higher pyramid level than the
detection scale.
Maximally stable extremal regions
(MSERs)
Gradient location-orientation histogram
(GLOH) descriptor
Gradient location-orientation histogram
(GLOH) descriptor
corners = detectHarrisFeatures(I);
Example: SURF features
10 Strongest
points = detectSURFFeatures(I);
Example: SURF features
30 Strongest
Example: SURF features
80 Strongest
Example: MSER with upright SURF
feature descriptor
regions = detectMSERFeatures(I);
Feature Matching
• Image Segmentation