Professional Documents
Culture Documents
Ji Hui
September 7, 2021
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 1 / 34
Image feature
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 3 / 34
Whatcauses
What causesanedges
edge?
[Source: K. Grauman]
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 4 / 34
Image gradient
Image gradient
rf = [ @f @f
@x , @y ]
Direction : ✓ = tan 1 ( @f @f
@y / @x )
q
2
Strength : krf k2 = | @f @f 2
@x + | @y | .
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 5 / 34
Edge vs gradient
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 6 / 34
Edge operators
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 7 / 34
Smoothing
Noise make direct calculation of gradient unreliable
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 8 / 34
Sobel operator
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 9 / 34
Zero-crossing
Consider a Gaussian filter h.
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 10 / 34
2D Gaussian edge detector
Laplacian of Gaussian
@2 @2
where r2 = @x2 + @y 2 .
Detection/Localization trade-off
More smoothing improves detection, but hurts localization
Less smoothing improves localization, but sensitive to noise
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 11 / 34
Canny edge detector
Basic procedure
Smooth image I with 2D Gaussian: G ⌦ I
Find local edge normal direction for each pixel
r(G ⌦ I)
~n =
kr(G ⌦ I)k
@ 2 (G ⌦ I)
.
@~n2
Edge thresholding: only select ”strong edges”
⇢
1 if kr(G ⌦ I)(r)k > T
E(r) =
0 otherwise.
thresholding thinning
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 13 / 34
Effect of scale in Canny edge detector
Effect of (Gaussian kernel spread/size)
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 14 / 34
Finding lines in an image
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 15 / 34
Finding lines in Hough space
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 16 / 34
Finding lines in Hough space
What is the line parameters for the line that contains both (x0 , y0 ) and
(x1 , y1 )?
The intersection of the lines b = –x0 m + y0 and b = –x1 m + y1 .
How to find the most likely parameters (m, b) for the most prominent line
in the image space?
Let each edge point in image space vote for a set of possible parameters in
Hough space
Accumulate votes in discrete set of bins; and parameters with the most votes
indicate line in image space.
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 17 / 34
Algorithm of Hough transform
Polar representation of lines
x cos ✓ y sin ✓ = d
Basic algorithm
Initial H[d, ✓] = 0
For each edge point at [x, y] in the image:
for each ✓
d = x cos ✓ y sin ✓
H[d, ✓] = H[d, ✓] + 1
Find the value of (d, ✓) where H[d, ✓] is maximum
The line detected is given by d = x cos ✓ y sin ✓.
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 18 / 34
Example of Hough transform
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 19 / 34
Generalized to circle detection
Circle (x a)2 + (y b)2 = r2 : center (a, b) and radius r
Example
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 20 / 34
Summary of hough transform
Pros
All points are processed independently, so can cope with occlusion, gaps
Some robustness to noise: noise points unlikely to contribute consistently to
any single bin
Can detect multiple instances of a model in a single pass
Cons
Complexity of search time increases exponentially with the number of model
parameters
Non-target shapes can produce spurious peaks in parameter space
Quantization: can be tricky to pick a good grid size
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 21 / 34
Robust line detection is not easy
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 22 / 34
Robust line detection is not easy
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 23 / 34
Corner Detector
Flat region, edge and Corner
Cx1 = 1 x1 , Cx2 = 2 x2 .
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 25 / 34
Classification of images points
λ2 “Edge”
λ2 >> λ1
“Corner”
λ1 and λ2 are large,
λ1 ~ λ2;
increases in all
directions
λ2 “Edge” “Corner”
• R depends only on R<0
eigenvalues of M
• R is large for a corner R>0
• R is negative with large
magnitude for an edge
• |R| is small for a flat region
“Flat” “Edge”
|R| small R<0
λ1
21
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 27 / 34
Harris corner detector
Basic procedure
1 Compute the gradients at each point in the image
2 Compute C for each window to get its cornerness scores.
3 Compute the eigenvalues
4 Find points whose surrounding window gave large corner response
(f > threshold)
5 Take the points of local maxima, i.e., perform non-maximum suppression
Demonstration with different thresholds
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 28 / 34
yramid,
Scaleand then matching
invariant interestfeatures
points at the same level.
en does this work?
How can we independently select interest points in each image, such that
re efficient to extract features stable in both location and scale
the detections are repeatable across different scales?
extract
d scale that features
gives stable
local in both location
maxima and scale f in both position an
of a function
Find scale that gives local maxima of a function f in both position and scale.
K. Grauman]
Urtasun (TTI-C)
Ji Hui (National University of Singapore)
Computer Vision
Visual Information Interpretation: Image feature September 7, 2021
Jan 17, 201
29 / 34
Scale-invariant interesting point by DOG
Computing a set of differences of Gaussian filters (DOG) for finding 3D
(space+scale) maxima in the resulting structure.
D( )f = (hk h ) ⌦ f.
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 30 / 34
Example
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 31 / 34
Local feature descriptor
Once keypoints are detected, the next question is how to describe them?
An ideal descriptor of keypoints
Robust to affine transform, lighting, noise
distinctive for accurate and fast matching
SIFT: Scale invariant Feature transform
Empirically found to show very good performance, invariant to image
rotation, scale, intensity change
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 32 / 34
Orientation histogram
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 33 / 34
SIFT descriptor
4 ⇥ 4 Gradient window
Histogram of 4 ⇥ 4 samples per window in 8 directions
Gaussian weighting around center
4 ⇥ 4 ⇥ 8 = 128 dimensional feature vector
Ji Hui (National University of Singapore) Visual Information Interpretation: Image feature September 7, 2021 34 / 34