Professional Documents
Culture Documents
Lecture 3
Lecture 3
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Camera Pose Estimation and RANSAC
Estimation
RANSAC
Srikumar Ramalingam
School of Computing
University of Utah
Presentation Outline
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review 1 Review
Pose
Estimation
RANSAC
2 Pose Estimation
3 RANSAC
Camera Models and Projection (Reminder)
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Projection of 3D point on the image:
Xm
Review
u
Ym
Pose
v ∼
R −Rt
Estimation K 0
0T 1 Zm
RANSAC 1
1
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
The projection matrix that maps 3D points to 2D image is
Review
given by:
Pose
Estimation R −Rt
P= K 0
RANSAC 0T 1
P= KR −KRt
P = KR I −t
What is Camera Calibration?
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
The task refers to the problem of computing the
RANSAC calibration matrix K.
In other words, we compute the focal length, principal
point, and aspect ratio in the camera matrix.
Forward Projection
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Xm
u Ym
v ∼ KR I −t
Zm
1
1
Backward Projection
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Q ∼ K−1 q
u
Q ∼ K−1 v
1
Presentation Outline
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review 1 Review
Pose
Estimation
RANSAC
2 Pose Estimation
3 RANSAC
What is pose estimation?
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam The problem of determining the position and orientation of the
camera relative to the object (or vice-versa).
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
The problem of determining the position and orientation of the
Srikumar
Ramalingam camera relative to the object (or vice-versa).
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Qm m m
1 , Q2 , Q3
Input and Unknowns
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Given qi , Qm
i , i = {1, 2, 3}, and K in the following equation:
Estimation
qi = KR I −t Qm
RANSAC
i , i = {1, 2, 3}
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Given the three 3D points Qm i , i = {1, 2, 3} we compute
Review the 3 pairwise distances d12 , d23 , and d31 as follows:
Pose
Estimation
RANSAC
dij = dist(Qm m
i , Qj )
dist(Qm m
i , Qj ) =
q
(Xim − Xjm )2 + (Yim − Yjm )2 + (Zim − Zjm )2
World frame to Camera frame
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Let the three 3D points Qm i , i = {1, 2, 3} be denoted by
c
Qi , i = {1, 2, 3} in the camera coordinate system.
Review
Pose
Estimation
In other words, we have Qci = RQm
i − Rt.
RANSAC Here Qm c
i ’s are known variables and Qi ’s are unknowns.
It is easy to observe the following since the distance
between two points do not change when we transform
them from one coordinate frame to another:
dist(Qm m c c
i , Qj ) = dist(Qi , Qj )
Reformulation of Pose Estimation
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Qci ∼ K−1 qi
Qci = λi K−1 qi
Here λi is an unknown scalar that determines the distance of
the 3D point Qci from the optical center along the ray OQci .
Reformulation of Pose Estimation
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Qci = λi K−1 qi
We simplify the notations, let us denote K−1 qi as follows:
Xi
K−1 qi = Yi (1)
Zi
Reformulation of Pose Estimation
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Xi
Qci = λi Yi
Zi
The pose estimation can be seen as the computation of the
unknown λi parameters.
Reformulation of Pose Estimation
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
q
(λi Xi − λj Xj )2 + (λi Yi − λj Yj )2 + (λi Zi − λj Zj )2 = dij
Reformulation of Pose Estimation
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
(λ1 X1 − λ2 X2 )2 + (λ1 Y1 − λ2 Y2 )2 + (λ1 Z1 − λ2 Z2 )2 = d12
2
RANSAC
(λ3 X3 − λ1 X1 )2 + (λ3 Y3 − λ1 Y1 )2 + (λ3 Z3 − λ1 Z1 )2 = d31
2
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Out of the 8 solutions, only one will be the correct
Pose
Estimation solution.
RANSAC
In some of the solutions, the 3D point will be behind the
camera.
Using additional point correspondence, we can identify the
correct solution.
Computing the Pose
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
We remind you the relation between Qci and Qm
i :
Pose c m
Estimation Qi = RQi − Rt.
RANSAC
We are given Qm c
i and we have computed Qi .
From three 3D-to-3D point correspondences we can
compute the transformation parameters (R, t) using
Horn’s method.
Presentation Outline
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review 1 Review
Pose
Estimation
RANSAC
2 Pose Estimation
3 RANSAC
Matching Images
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Matching Images
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC Lets consider a simpler example linear regression.
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Given a hypothesized line.
Pose
Estimation Count the number of points that agree with the line, i.e.,
RANSAC points within a small distance of the line.
For all possible lines, select the one with the largest
number of inliers.
Slide: Noah Snavely
Counting Inliers
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
3 inliers
Slide: Noah Snavely
Counting Inliers
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
20 inliers!
Slide: Noah Snavely
How do we find the best line?
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation Unlike least-squares, no simple closed-form solution
RANSAC Hypothesize-and-test
Try out many lines, keep the best one
Which lines?
Translations
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Idea:
Review
Pose
All the inliers will agree with each other on the translation
Estimation vector; the (hopefully small) number of outliers will
RANSAC (hopefully) disagree with each other
RANSAC only has guarantees if there are ≤ 50% outliers
All good matches are alike; every bad match is bad in its
own way - Alyosha Efros, CMU
Slide: Noah Snavely
Pose Estimation
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Inliers?
Pose Estimation
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Inliers?
Pose Estimation
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Inliers?
Pose Estimation
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Inliers?
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Inlier threshold related to the amount of noise we expect
Review in inliers
Pose Often model noise as Gaussian with some standard
Estimation
deviation (e.g., 3 pixels)
RANSAC
Number of rounds related to the percentage of outliers
we expect, and the probability of success we would like to
guarantee
Suppose there are 20% outliers, and we want to find the
correct answer with 99% probability
How many rounds do we need?
Sample size
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
1 Randomly choose s samples
Review Typically s = minimum sample size that lets you fit a
Pose model
Estimation
RANSAC
2 Fit a model (e.g., line) to those samples
3 Count the number of inliers that approximately fit the
model
4 Repeat N times
5 Choose the model that has the largest set of inliers
Slide: Noah Snavely
How many rounds?
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam
Review
Pose
Estimation
RANSAC
Camera Pose
Estimation
and RANSAC
Srikumar
Ramalingam