Agenda
• Rotations
• Camera calibration
• Ransac Geometric Transformations y
164 Computer Vision: Algorithms andx Applications (September 3, 2010 draft)
Transformation Matrix # DoF Preserves Icon
translation I t 2 orientation 2 3 h i ⇥ ⇢⇢SS rigid (Euclidean) R t 3 lengths S ⇢ 2 3 S⇢ ⇥ h i ⇢ similarity sR t 4 angles S 2 3 S⇢ h i ⇥ ⇥ ⇥ affine A 6 parallelism ⇥ ⇥ 2 3 h i ⇥ projective H˜ 8 straight lines ` 3 3 ` h i ⇥ Table 3.5 Hierarchy of 2D coordinate transformations. Each transformation also preserves Let’s definethe properties families listed of in thetransformations rows below it, i.e., similarity by the preserves properties not only anglesthat butthey also preserve parallelism and straight lines. The 2 3 matrices are extended with a third [0T 1] row to form ⇥ a full 3 3 matrix for homogeneous coordinate transformations. ⇥
amples of such transformations, which are based on the 2D geometric transformations shown in Figure 2.4. The formulas for these transformations were originally given in Table 2.1 and are reproduced here in Table 3.5 for ease of reference.
In general, given a transformation specified by a formula x0 = h(x) and a source image f(x), how do we compute the values of the pixels in the new image g(x), as given in (3.88)? Think about this for a minute before proceeding and see if you can figure it out. If you are like most people, you will come up with an algorithm that looks something like Algorithm 3.1. This process is called forward warping or forward mapping and is shown in Figure 3.46a. Can you think of any problems with this approach?
procedure forwardWarp(f,h, out g):
For every pixel x in f(x)
1. Compute the destination location x0 = h(x).
2. Copy the pixel f(x) to g(x0).
Algorithm 3.1 Forward warping algorithm for transforming an image f(x) into an image g(x0) through the parametric transform x0 = h(x). Rotations Linear transformations that preserve distances and angles
Definition: an orthogonal transformation perserves dot products T T n n n a Tb = F (a) F (b)whereF (a)=Aa, a Rn ,A Rn n⇥ a b = T (a)T (b)whereT (a)=Aa, a 2R ,A 2R ⇥ 2 2 T T T T a b = a A Ab A A = I [can conclude by setting a,b = coordinate vectors] ()
Defn: A is a rotation matrix if ATA = I, det(A) = 1 Defn: A is a reflection matrix if ATA = I, det(A) = -1 2D Rotations
cos ✓ sin ✓ R = sin ✓ cos ✓
1 DOF 3D Rotations
X r11 r12 r13 X R Y = r r r Y 2 3 2 21 22 233 2 3 Z r31 r32 r33 Z 4 5 4 5 4 5 Think of as change of basis where ri = r(i,:) are orthonormal basis vectors
r2
r1 rotated
coordinate frame r3
How many DOFs?
3 = (2 to point r1 + 1 to rotate along r1) 7 Shears
1 hxy hxz 0 h 1 h 0 A˜ = 2 yx yz 3 hzx hzy 10 6 00017 6 7 4 Shears y into5 x
7
3D Rotations 8 LotsRotations of parameterizations that try to capture 3 DOFs
Helpful• 3D Rotations one for fundamentally vision: axis-angle more complex representation than in 2D! • 2D: amount of rotation! Represent a 3D rotation with a unit vector that represents the axis of • 3D: amount and axis of rotation rotation, and an angle of rotation about that vector
-vs-
2D 3D 8
05-3DTransformations.key - February 9, 2015 Recall: cross-product
Dot product: a b = a b cos✓ · || || || ||
Cross product:
ijk a2 a3 a1 a3 a1 a2 a1 a2 a3 = i j + k b2 b3 b1 b3 b1 b2 b b b 1 2 3
Cross product 0 a a b 3 2 1 matrix: a b = ˆab = a3 0 a1 b2 ⇥ 2 a a 0 3 2b 3 2 1 3 4 5 4 5 Approach
! R3, ! =1 2 || ||
✓ x Approach
! R3, ! =1 2 || || x ? ✓ x k x
1. Write as x as sum of parallel and perpindicular component to omega 2. Rotate perpindicular component by 2D rotation of theta in plane orthogonal to omega R = I +ˆw sin ✓ +ˆwwˆ(1 cos ✓) [Rx can simplify to cross and dot product computations] Exponential map
! R3, ! =1 2 || || x ? ✓ x k x
R =exp(ˆv), where v = !✓ 1 = I +ˆv + vˆ2 + ... 2!
[standard Taylor series expansion of exp(x) @ x=0 as 1 + x + (1/2!)x2 +…]
Implication: we can approximate change in position due to a small rotation as v x, where v = !✓ ⇥ Agenda
• Rotations
• Camera calibration
• Homography
• Ransac Perspective projection
y
x (X,Y,Z) (x,y,1)
z COP
[right-handed coordinate system]
f x = X Z f y = Y Z Perspective projection revisited
x f 00 X y = 0 f 0 Y 213 20013 2Z 3 4 5 4 5 4 5 Given (X,Y,Z) and f, compute (x,y) and lambda: