SLIDE 1 Homographies and Estimating Extrinsics
Instructor - Simon Lucey
16-423 - Designing Computer Vision Apps
SLIDE 2 Review: Motivation
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 3 Review: Pinhole Camera
Real camera image is inverted Instead model impossible but more convenient virtual image
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 4 Today
- Fitting Warp Functions.
- Estimating Intrinsics.
SLIDE 5 Euclidean warp
- Consider viewing a fronto-parallel plane at a fixed
distance D.
- In homogeneous coordinates, the imaging equations are:
3D rotation matrix becomes 2D (in plane) Plane at known distance D Point is on plane (w=0)
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 6 Euclidean warp
- Simplifying
- Rearranging the last equation
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 7 Euclidean warp
Homogeneous: Cartesian: For short:
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 8 Euclidean warp
Homogeneous: Cartesian: For short:
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
How many unknowns?
SLIDE 9
Estimating the Euclidean Warp ˆ Ω, ˆ τ = arg min
Ω,τ N
X
n=1
η{xn − euc[wn, Ω, τ]}
SLIDE 10 Estimating the Euclidean Warp
ˆ Ω, ˆ τ = arg min
Ω,τ N
X
n=1
||xn − euc[wn, Ω, τ]||2
2
SLIDE 11 Estimating the Euclidean Warp
ˆ Ω, ˆ τ = arg min
Ω,τ N
X
n=1
||xn − euc[wn, Ω, τ]||2
2
= arg min
Ω,τ N
X
n=1
||xn − Ωwn + τ||2
2
SLIDE 12 Estimating the Euclidean Warp
ˆ Ω, ˆ τ = arg min
Ω,τ N
X
n=1
||xn − euc[wn, Ω, τ]||2
2
= arg min
Ω,τ N
X
n=1
||xn − Ωwn + τ||2
2
s.t. ΩT Ω = I, det(Ω) = 1
SLIDE 13 Reminder: Non-Convex Set
9
SLIDE 14 Reminder: Non-Convex Set
9
SLIDE 15 Reminder: Non-Convex Set
9
SLIDE 16 Estimating the Euclidean Warp s.t. ΩT Ω = I, det(Ω) = 1
µx = 1 N
N
X
n=1
xn, µw = 1 N
N
X
n=1
wn
ˆ Ω = arg min
Ω N
X
n=1
||(xn − µx) − Ω(wn − µw)||2
2
SLIDE 17
>> [U,S,V] = svd(B*A’,0); >> Omega = U*V’;
- SVD method works for ONLY very specific objectives.
- Extremely useful as it allows us to find closed form solutions
to a non-convex problem (very rare).
Estimating the Euclidean Warp
SLIDE 18 Similarity warp
- Consider viewing fronto-parallel plane at unknown
distance D
- By same logic as before we have
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 19 Similarity warp
- Multiply each equation by :
- Simplifying:
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 20 Similarity warp
- Simplifying:
- Incorporate the constants by defining:
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 21
Similarity warp
Homogeneous: Cartesian: For short:
SLIDE 22
Similarity warp
Homogeneous: Cartesian: For short:
How many unknowns?
SLIDE 23 Estimating the Similarity Warp
SLIDE 24 Estimating the Similarity Warp
- Rearranging:
- Form system of equations:
SLIDE 25 Estimating the Similarity Warp
>> p = A\x;
- Since p stems form a convex set, simply use “backslash”!!!
SLIDE 26 Estimating the Similarity Warp
>> p = A\x;
- Since p stems form a convex set, simply use “backslash”!!!
SLIDE 27 Estimating the Similarity Warp
>> p = A\x;
- Since p stems form a convex set, simply use “backslash”!!!
SLIDE 28 Affine warp
Affine transform describes mapping well when the depth variation within the planar object is small and the camera is far away. When variation in depth is comparable to distance to object then the affine transformation is not a good model. Here we need the homography.
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 29
Affine warp
Homogeneous: Cartesian: For short:
SLIDE 30
Affine warp
Homogeneous: Cartesian: For short:
How many unknowns?
SLIDE 31 Estimating the Affine Warp
- Rearranging:
- Form system of equations:
- In MATLAB this becomes,
>> p = A\x;
SLIDE 32 Homography
- Start with basic projection equation:
- Combining these two matrices we get:
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 33
Homography
Homogeneous: Cartesian:
For short:
SLIDE 34
Homography
Homogeneous: Cartesian:
For short:
How many unknowns?
SLIDE 35 Homography Estimation
- Re-arrange cartesian equations,
−u1 −v1 −1 y1u1 y1v1 y1 u1 v1 1 −x1u1 −x1v1 −x1 −u2 −v2 −1 y2u2 y2v2 y2 u2 v2 1 −x2u2 −x2v2 −x2 . . . . . . . . . . . . . . . . . . . . . . . . . . . −uI −vI −1 yIuI yIvI yI uI vI 1 −xIuI −xIvI −xI φ11 φ12 φ13 φ21 φ22 φ23 φ31 φ32 φ33 = 0,
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 36 Homography Estimation
>> [U,S,V] = svd(A); >> Phi = reshape(V(:,end),[3,3])’;
- Both sides are 3x1 vectors; should be parallel, so cross
product will be zero
>> x = [randn(2,1);1]; cross(x,4*x)
SLIDE 37 Caution…
- Approach only minimizes algebraic error NOT the re-
projection error!!!
- Need to employ non-linear optimization.
SLIDE 38 Today
- Fitting Warp Functions.
- Estimating Extrinsics.
SLIDE 39
Estimating Extrinsics
SLIDE 40 Estimating Extrinsics
- Writing out the camera equations in full
- Estimate the homography from matched points
- Factor out the intrinsic parameters
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 41 Estimating Extrinsics
- Find the last column using the cross product of first two
columns
- Make sure the determinant is 1. If it is -1, then multiply
last column by -1.
- Find translation scaling factor between old and new
values
Adapted from: Computer vision: models, learning and inference. Simon J.D. Prince
SLIDE 42
Augmented Reality
SLIDE 43 Transformations between images
- So far we have considered
transformations between the image and a plane in the world
viewing the same plane
- There is a homography between
camera 1 and the plane and a second homography between camera 2 and the plane
- It follows that the relation between the two images is also a
homography
SLIDE 44
Camera under pure rotation
Special case is camera under pure rotation. Homography can be showed to be
SLIDE 45
Camera under pure rotation
Special case is camera under pure rotation. Homography can be showed to be
Why is this?
SLIDE 46 Panorama Example
a) b) c) d)
SLIDE 47 More to read…
- Prince et al.
- Chapter 14, Sections 1-4.
- Chapter 15, Sections 1-6.