CSE Project #1 Solution

$35.00 $29.00

• Rotation Matrix (5 points) Figure 1 illustrates the transformation from coordinate xyz to XYZ: 1)rotate around z axis with = 45 to get x0y0z0 axis; 2) rotate around x0 axis with = 30 to get x00y00z00; 3) rotate around z00 axis with = 60 to get XYZ. Design a program to get the rotation…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

• Rotation Matrix (5 points)

Figure 1 illustrates the transformation from coordinate xyz to XYZ: 1)rotate around z axis with

= 45 to get x0y0z0 axis; 2) rotate around x0 axis with = 30 to get x00y00z00; 3) rotate around z00 axis with = 60 to get XYZ.

Design a program to get the rotation matrix from xyz to XYZ. Design a program to get the rotation matrix from XYZ to xyz.

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 1: Illustration of Eular angles.

 

• Camera Calibration (5 points)

Preliminary.1.

The projection from world coordinate to image plane can be indicated by intrinsic parameters (Camera) and extrinsic parameters(World). From world coordinate to camera coordinate, the extrinsic parameters can be used as

 

M = Min Mex
=
2 0
fy
oy 3 2r21
r22
r23
Ty 3

 

 

 

fx
0
ox
r11
r12
r13
Tx

2m21
m22
m23

=
4 0
0
1 5 4r31 r32
r33 Tz 5
+ oyr33

 

m243

2fyr21
+ oyr31
fyr22
+ oyr32
fyr23

4
m11
m12
m13
m14
5

fxr11
+ oxr31
fxr12
+ oxr32
fxr13
+ oxr33

m31
m32
m33
m34

4

r31

r32

r33

 

 

 

3 (1)
fxTx + oxTz
fyTy + oyTz 5 :
Tz
Let’s de ne m1 = (m11; m12; m13)T ; m2 = (m21; m22; m23)T ; m3 = (m31; m32; m33)T ; m4 =
(m14; m24; m34)T . Also de ne r1 = (r11; r12; r13)T ; r2 = (r21; r22; r23)T ; r3 = (r31; r32; r33)T . Observe that (r1; r2; r3) is the rotation matrix, then

 

 

(r1; r2; r3) 0
T
1

 

 

 

 

 

 

 

 

r2T

=
0 1 0
:

 

 

 

 

B
r3T
C

0
0
0
11

 

 

 

 

@
r1
A

@
1
0
0

 

 

 

 

 

 

 

 

A

 

 

 

Then we have riT ri = 1; riT rj = 0 (i 6= j).

 

 

 

 

 

 

 

From M we have

 

 

 

 

 

 

 

 

m1T m3 = r31(fxr11 + oxr31) + r32(fxr12 + oxr32) + r33(fxr13 + oxr33)

 

= fx(r11r31 + r12r32 + r13r33) + ox(r312 + r322 + r332)

(2)

 

= fx(r1T r3) + ox(r3T r3)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

= ox

 

 

 

 

 

 

 

Similarly, Next, from M we have

 

 

 

 

 

 

 

 

m1T m1 = (fxr11 + oxr31)2 + (fxr12 + oxr32)2 + (fxr13
+ oxr33)2

 

= fx2 r1T r1 + 2fxox r1T r3 + ox2 r3T r3 = fx2
+ ox2
(3)

p

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

mT m2

 

So fx =
mT m1
o2 . Similarly we have oy = mT m3, fy =

o2
. Overall, we come to

1
x

 

2

 

2

y

the conclusion as follows

 

 

 

q

 

 

 

ox = m1T m3
oy = m2T m3

 

 

(4)

 

fx = q

fy = q

 

 

 

 

 

m1T m1
ox2

m2T m2

oy2

(5)
Preliminary.2.

Let XwYwZw be the world coordinate and xy be the image coordinate, we have the transformation matrix M 2 R3 4:
s y
=

m21
m22
m23
m24

2
Yw
3
(6)
2 3

2
m11
m12
m13
m14
3

Xw

 

 

 

 

 

Zw

x

4

 

5

6
1
7

1

m31
m32
m33
m34

 

 

4 5

 

 

 

6

7

 

 

 

 

4

5

sx = m11Xw
sy = m21Xw
s = m31Xw
• m12Yw

• m22Yw

We can solve mij with the equation below:

2Xw1 Yw1

6Xw1 Yw1
6
6
6
6
6
6
6
6
6
6
6
6
6
4Xn Y n
w w

 

Zw1 1
0
0
0 0
x1Xw1
Zw1 1
0
0
0 0
x1Xw1

 

:

 

 

:

 

 

:

 

 

:

 

 

:

 

 

:

Zn
1
0
0
0 0
xnXn
w

 

w
Zn
1
0
0
0 0
xnXn
w

 

w

x1Yw1
x1Zw1
x1 3 2m133

 

 

 

6
m11
7

x1Yw1
x1Zw1
x1

 

m12

 

 

 

 

m14

 

 

7

6

7

 

 

6
m21
7

 

 

7

6

7

 

 

7
6
m22
7
= 0;
(8)

 

7
6
m

7

 

 

7
6

7

 

 

7

6
m
23
7

 

 

7
6

7

 

 

7

6
m
24
7

 

 

7
6

7

 

 

7

6

31
7

xnY n
xnZn
xn
7 6
m
32
7

w
w

7
6

7

xnY n
xnZn
xn
7 6
m
33
7

w
w

7
6
m

7

 

 

5
6

7

 

 

 

6

34
7

 

 

 

4

5

where the rst matrix is with size 2n 12 (n is the number of available points).

Preliminary.3.

Solve the homogeneous linear equation Ax = 0, where x is the vector of N unknowns, and A is the matrix of M N coe cients. A quick observation is that there are in nite solutions for Ax = 0, since we can randomly scale x with a scalar such that A( x) = 0. Therefore, we assume kxk = 1. Solving the equation can be converted to

min kAxk
(9)

The minimization problem can be solved with Singular Value Decomposition (SVD). Assume that A can be decomposed to U VT , we have

min kAxk = kU VT xk = k VT xk:

Note that kVT xk = kxk = 1, then let y = VT x, so we have

min kAxk = k yk

 

 

 

 

2 1
. . .

3

y

 

 

 

 

 

1

=

 

n.

;

6
0

0
7
2
..
3

6

 

7

 

 

6
..

..
7

yn

 

6

..

7 6 7

6
. .
.
7 4

5

6

 

7

 

 

6
0

0
7

 

 

4

 

5

 

 

 

 

 

 

 

 

 

 

 

 

 

(10)

 

 

 

(11)
where 1n0. Recall that kyk = 1, we can set

2

3
=
2
..
3
:
(12)

y1

 

0

 

6yn
7

.
7

 

 

61

 

4

5

4

5

So x should be the last row of VT .
Question

Figure 2 shows an image of the checkerboard, where XY Z is the world coordinate and xy is marked as the image coordinate. The edge length of each grid on the checkerboard is 10mm in reality. Suppose one pixel of the image is equivalent to 1mm. You can calculate the projection matrix from world coordinate to image coordinate based on the 32 marked points on the checkerboard. From

2
f
0
ox
3

the projection matrix you can get the intrinsic matrix which is indicated as

0x
fy
oy

(fx and

4
0
0
1
5

fy are not necessarily be the same).

Design a program to obtain the intrinsic parameters fx, fy, ox, oy.

If the original point of world coordinate changed, would the intrinsic parameters be the same?

In this task you are only allowed to use the library and library function already im-ported in the script \task2.py”.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CSE Project #1 Solution
$35.00 $29.00