You are on page 1of 26

RANSAC: Random Sample Consensus

Linear Homogeneous Equations


Linear least square solve produces a trivial solution:
x = ( A A ) A Tb
-1
T
x=0
An additional constraint on x to avoid the trivial solution: x = 1

1) rank(A) = r < n -1 : infinite number of solutions n


A x = 0 x = r +1Vr +1 + + n Vn where i =1
2

i = r +1

2) rank(A) = n -1 : one exact solution


mxn nx1 mx1
x = Vn
3) n <m : no exact solution in general (needs least squares)
2
min Ax subject to x =1 x = Vn
x
Nullspace

A = U D VT

mxn mxn nxn nxn

null(A) = Vr :n A Vr :n = 0
Line fitting
E i = ex i + fy i + g
Perpendicular distance

ex + fy + g =0

Line fitting error:


2
x 1 y 1 1 e
=E = f Ax
2

x N y N 1 g
Line fitting
E i = ex i + fy i + g
Perpendicular distance

ex + fy + g =0

2
minimize Ax
x

subject to x = 1
x = V3 where A = UDV T
V = [ V1 V2 V3 ]
Outlier
Line fitting
E i = ex i + fy i + g
Perpendicular distance

ex + fy + g =0
Quadratic magnification of error of outliers

Outlier
Line fitting error:
(ex 1 - fy 1 - g ) + + (ex N - fy N - g )
2 2
=E
N
= (ex i - fy i - g )
2

i
RANSAC: Random Sample Consensus

E i = ex i + fy i + g
Perpendicular distance

ex + fy + g =0

Outlier

Strategy:
To find a model that accords with the maximum number of samples
RANSAC: Random Sample Consensus

E i = ex i + fy i + g
Perpendicular distance

ex + fy + g =0

Outlier

Strategy:
To find a model that accords with the maximum number of samples

Assumptions:
1. Majority of good samples agree with the underlying model (good apples are same and simple.).
2. Bad samples does not consistently agree with a single model (all bad apples are different and
complicated.).
RANSAC: Random Sample Consensus
RANSAC: Random Sample Consensus

Random sampling
RANSAC: Random Sample Consensus

Random sampling
Model building
RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding


RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting

# of inliers: 7

RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting
RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting
RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting
RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting

# of inliers: 10
RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting
RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting
RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting

# of inliers: 23
Maximum number of inliers
RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting

# of inliers
Probability of choosing an inlier: w=
# of samples
RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting

# of inliers
Probability of choosing an inlier: w=
# of samples
n
Probability of building a correct model: w where n is the number of samples to build a model.
RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting

# of inliers
Probability of choosing an inlier: w=
# of samples
n
Probability of building a correct model: w where n is the number of samples to build a model.

(
Probability of not building a correct model during k iterations: 1- w )
n k
RANSAC: Random Sample Consensus

Random sampling
Model building
Thresholding
Inlier counting

# of inliers
Probability of choosing an inlier: w=
# of samples
n
Probability of building a correct model: w where n is the number of samples to build a model.

(
Probability of not building a correct model during k iterations: 1- w )
n k

log (1- p )
(1-w ) n k
= 1- p where p is desired RANSAC success rate. k=
log (1-w n )

You might also like