RANSAC CS 4495 Computer Vision – A. Bobick
Aaron Bobick School of Interactive Computing
CS 4495 Computer Vision RAN dom SA mple C onsensus Aaron Bobick - - PowerPoint PPT Presentation
RANSAC CS 4495 Computer Vision A. Bobick CS 4495 Computer Vision RAN dom SA mple C onsensus Aaron Bobick School of Interactive Computing RANSAC CS 4495 Computer Vision A. Bobick Administrivia PS 3: Check Piazza - good
RANSAC CS 4495 Computer Vision – A. Bobick
Aaron Bobick School of Interactive Computing
RANSAC CS 4495 Computer Vision – A. Bobick
the epipolar lines you get.
Since we’re using homogenous coordinates (2D homogenous have 3 elements) it’s easy to have a transformation matrix that subtracts off an
is both a point and a line.
RANSAC CS 4495 Computer Vision – A. Bobick
matches
RANSAC CS 4495 Computer Vision – A. Bobick
C.Harris, M.Stephens. “A Combined Corner and Edge Detector”. 1988
RANSAC CS 4495 Computer Vision – A. Bobick
2
1 2 1 2
(k – empirical constant, k = 0.04-0.06)
x x x y T x y y y
RANSAC CS 4495 Computer Vision – A. Bobick
λ1 “Corner” “Edge” “Edge” “Flat”
eigenvalues of M
magnitude for an edge
region R > 0 R < 0 R < 0 |R| small
RANSAC CS 4495 Computer Vision – A. Bobick
extremum (maximum or minimum) both in space and in scale.
DoG pyramid to find maximum values (remember edge detection?) – then eliminate “edges” and pick only corners.
detector to find maximums in space and then look at the Laplacian pyramid (we’ll do this later) for maximum in scale.
Blur Resample SubtractEach point is compared to its 8 neighbors in the current image and 9 neighbors each in the scales above and below.
RANSAC CS 4495 Computer Vision – A. Bobick
invariant and as distinctive as possible. (Competing goals) SIFT
RANSAC CS 4495 Computer Vision – A. Bobick
Want to find … in here
RANSAC CS 4495 Computer Vision – A. Bobick
SIFT Features
coordinates that are invariant to translation, rotation, scale, and other imaging parameters
RANSAC CS 4495 Computer Vision – A. Bobick
pixels
much.
showing only 2x2 here but is 4x4
RANSAC CS 4495 Computer Vision – A. Bobick
invariant and as distinctive as possible. (Competing goals) SIFT
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
with T)
RANSAC CS 4495 Computer Vision – A. Bobick
with T)
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
descriptors (randomly)
RANSAC CS 4495 Computer Vision – A. Bobick
“similar enough” matches?
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
descriptors (randomly)
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick Source: K. Grauman
features – remember this??? simple model: lines simple model: circles complicated model: car
RANSAC CS 4495 Computer Vision – A. Bobick
Case study: Line detection
Slide: S. Lazebnik
RANSAC CS 4495 Computer Vision – A. Bobick
2 2
T T
dE d = − = X Xb X y b
2 2 1 1 2 1
1 1 1
n i i i n n
y x m m E y x b b y x
=
= − = − = −
y Xb
Standard least squares solution to except weird switch of typical names from Ax=b
n i i i
1 2
(xi, yi) y=mx+b
1 T T T T −
( ) ( 2( ) ( ) ( )
T T T T
= − − = − + y Xb y Xb) y y Xb y Xb Xb
b
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
line ax+by=d (a2+b2=1): |axi + byi – d|
∑ =
− + =
n i i i
d y b x a E
1 2
) ( (xi, yi)
ax+by=d
Unit normal: N=(a, b)
RANSAC CS 4495 Computer Vision – A. Bobick
(xi, yi) and line ax+by=d
the sum of squared perpendicular distances
− + =
n i i i
d y b x a E
1 2
) (
(xi, yi) ax+by=d
d
(xj, yj)
Unit normal: N=(a, b)
RANSAC CS 4495 Computer Vision – A. Bobick
line ax+by=d
squared perpendicular distances
n i i i
1 2
Unit normal: N=(a, b)
) ( 2
1
= − + − = ∂ ∂
n i i i
d y b x a d E
y b x a x n b x n a d
n i i n i i
+ = + =
= = 1 1
) ( ) ( )) ( ) ( (
2 1 1 1 2
UN UN b a y y x x y y x x y y b x x a E
T n n n i i i
= − − − − = − + − =∑ =
) ( 2 = = N U U dN dE
T
Solution to (UTU)N = 0, subject to ||N||2 = 1: eigenvector of UTU associated with the smallest eigenvalue (Again SVD to least squares solution to homogeneous linear system UN = 0) (xi, yi) ax+by=d
d
(xj, yj)
RANSAC CS 4495 Computer Vision – A. Bobick
points are corrupted by Gaussian noise in the direction perpendicular to the line
(x, y) ax+by=d (u, v)
point
line noise: sampled from zero-mean Gaussian with
normal direction
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
Problem: squared error heavily penalizes outliers
RANSAC CS 4495 Computer Vision – A. Bobick
ri (xi, θ) – residual of ith point w.r.t. model parameters θ ρ – robust function with scale parameter σ
i i i
The robust function ρ behaves like squared distance for small values of the residual u but saturates for larger values of u
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
“Correct” line “Best fit” line
RANSAC CS 4495 Computer Vision – A. Bobick
Applications to Image Analysis and Automated Cartography. Comm. of the ACM, Vol 24, pp 381-395, 1981.
RANSAC CS 4495 Computer Vision – A. Bobick
Algorithm:
Repeat 1-3 until the best model is found with high confidence
Fischler & Bolles in ‘81.
(RANdom SAmple Consensus) :
Illustration by Savarese
RANSAC CS 4495 Computer Vision – A. Bobick
Algorithm:
Repeat 1-3 until the best model is found with high confidence
Illustration by Savarese
Line fitting example
RANSAC CS 4495 Computer Vision – A. Bobick
Algorithm:
Repeat 1-3 until the best model is found with high confidence Line fitting example
Illustration by Savarese
RANSAC CS 4495 Computer Vision – A. Bobick
I
Algorithm:
Repeat 1-3 until the best model is found with high confidence Line fitting example
Illustration by Savarese
RANSAC CS 4495 Computer Vision – A. Bobick
I
Algorithm:
Repeat 1-3 until the best model is found with high confidence
Line fitting example
Illustration by Savarese
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
samples from which the model can be computed.
pairs/matches:
RANSAC CS 4495 Computer Vision – A. Bobick
freedoms
𝑔 𝑢 =
2𝑓−𝑢2
2
𝜌
, t ≥ 0
𝑢2 = 3.84𝜏2
RANSAC CS 4495 Computer Vision – A. Bobick
RANSAC CS 4495 Computer Vision – A. Bobick
is free from outliers (e.g. 𝑞 = 0.99) (outlier ratio: e)
Source: M. Pollefeys
RANSAC CS 4495 Computer Vision – A. Bobick
s
RANSAC CS 4495 Computer Vision – A. Bobick
𝑡 = 2, 𝑓 = 5% => N=2 𝑡 = 2, 𝑓 = 50% => N=17 𝑡 = 4, 𝑓 = 5% => N=3 𝑡 = 4, 𝑓 = 50% => N=72 𝑡 = 8, 𝑓 = 5% => N=5 𝑡 = 8, 𝑓 = 50% => N=1177
proportion of outliers e
s 5% 10% 20% 25% 30% 40% 50% 2 2 3 5 6 7 11 17 3 3 4 7 9 11 19 35 4 3 5 9 13 17 34 72 5 4 6 12 17 26 57 146 6 4 7 16 24 37 97 293 7 4 8 20 33 54 163 588 8 5 9 26 44 78 272 1177
s
𝑂 = 𝑔 𝑓 , not the number of points!
RANSAC CS 4495 Computer Vision – A. Bobick
What do we do about the “bad” matches?
RANSAC CS 4495 Computer Vision – A. Bobick
Select one match, count inliers
RANSAC CS 4495 Computer Vision – A. Bobick
Select one match, count inliers
RANSAC CS 4495 Computer Vision – A. Bobick
Find “average” translation vector
RANSAC CS 4495 Computer Vision – A. Bobick
1.
Select four feature pairs (at random)
2.
Compute homography 𝑰 (exact)
3.
Compute inliers where 𝑇𝑇𝑇(𝑞𝑥’, 𝑰 𝑞𝑥 ) < 𝜁
4.
Keep largest set of inliers
5.
Re-compute least-squares 𝑰 estimate on all of the inliers
RANSAC CS 4495 Computer Vision – A. Bobick
(translation, scale, rotation)
(homography)
Source: S. Lazebnik
RANSAC CS 4495 Computer Vision – A. Bobick
e.g. 50%, and adapt if more inliers are found, e.g. 80% would yield e=0.2
s
e p N − − − = 1 1 log / 1 log
Source: M. Pollefeys
RANSAC CS 4495 Computer Vision – A. Bobick
Good
Bad
Common applications