首页 > > 详细

CSE 473代做、代写Python设计编程

项目预算:   开发周期:  发布时间:   要求地区:
University at Buffalo
Department of Computer Science and Engineering
CSE 473/573 - Computer Vision and Image Processing
Fall 2023
Project #1
Due Date: 10/16/2023, 11:59PM
1 Rotation Matrix (4 points)
Figure 1 illustrates the transformation from coordinate xyz to XYZ: 1) rotate around z axis with α
(the current coordinate is x’y’z’); 2) rotate around x′ axis with β (the current coordinate is x”y”z”);
3) rotate around z′′ axis with γ (the current coordinate is XYZ). α, β, and γ are all given in angles
(not radians), and 0◦ < α, β, γ < 90◦
.
• Design a program to get the rotation matrix from xyz to XYZ. (2 points)
• Design a program to get the rotation matrix from XYZ to xyz. (2 points)
Figure 1: Illustration of Eular angles
We may test your code using different α, β, and γs in grading.
2 Camera Calibration (6 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 =


fx 0 ox
0 fy oy
0 0 1

 ·


r11 r12 r13 Tx
r21 r22 r23 Ty
r31 r32 r33 Tz




m11 m12 m13 m14
m21 m22 m23 m24
m31 m32 m33 m34

 =


fxr11 + oxr31 fxr12 + oxr32 fxr13 + oxr33 fxTx + oxTz
fyr21 + oyr31 fyr22 + oyr32 fyr23 + oyr33 fyTy + oyTz
r31 r32 r33 Tz

 .
(1)
Here, M is projection matrix. Let’s define m1 = (m11, m12, m13)
T
, m2 = (m21, m22, m23)
T
, m3 =
(m31, m32, m33)
T
, m4 = (m14, m24, m34)
T
. Also define 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)


r
T
1
r
T
2
r
T
3

 =


1 0 0
0 1 0
0 0 1

 .
Then we have r
T
i
ri = 1, r
T
i
rj = 0 (i ̸= j). In other words, ||r3|| = ||m3|| = 1.
From M we have
mT
1 m3 = r31(fxr11 + oxr31) + r32(fxr12 + oxr32) + r33(fxr13 + oxr33)
= fx(r11r31 + r12r32 + r13r33) + ox(r
2
31 + r
2
32 + r
2
33)
= fx(r
T
1
r3) + ox(r
T
3
r3)
= ox
(2)
Similarly, Next, from M we have
mT
1 m1 = (fxr11 + oxr31)
2 + (fxr12 + oxr32)
2 + (fxr13 + oxr33)
2
= f
2
x
· r1
T
r1 + 2fxox · r1
T
r3 + o
2
x
· r3
T
r3 = f
2
x + o
2
x
(3)
So fx =
p
mT
1 m1 − o
2
x
. Similarly we have oy = mT
2 m3, fy =
q
mT
2 m2 − o
2
y
. Overall, we come to
the conclusion as follows
ox = mT
1 m3 oy = mT
2 m3 (4)
fx =
q
mT
1 m1 − o
2
x
fy =
q
mT
2 m2 − o
2
y
(5)
Preliminary.2.
Let XwYwZw be the world coordinate and xy be the image coordinate, we have the transformation
matrix M ∈ R
3×4
:
s


x
y
1

 =


m11 m12 m13 m14
m21 m22 m23 m24
m31 m32 m33 m34

 ·




Xw
Yw
Zw
1




(6)

/sx = m11Xw + m12Yw + m13Zw + m14,
sy = m21Xw + m22Yw + m23Zw + m24,
s = m31Xw + m32Yw + m33Zw + m34.
(7)
We can solve mij with the equation below:
where the first matrix is with size 2n × 12 (n is the number of available points).
We apply Equation (9) to calculate m = {mij}. Specifically, x = λm denotes the direction of
m, where ∥x∥ = 1. If we know the values of λ and x, we can get m. To obtain the value of x,
applying Equation (9). To obtain the value of λ, we have ||m3|| = || 1
λ
x3|| = 1.
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 coefficients. A quick observation is that there are infinite solutions for Ax = 0,
since we can randomly scale x with a scalar λ such that A(λx) = 0. Therefore, we assume ∥x∥ = 1.
Solving the equation can be converted to
min ∥Ax∥ (9)
The minimization problem can be solved with Singular Value Decomposition (SVD). Assume that
A can be decomposed to UΣVT
, we have
min ∥Ax∥ = ∥UΣVT x∥ = ∥ΣVT x∥. (10)
Note that ∥VT x∥ = ∥x∥ = 1, then let y = VT x, so we have
min ∥Ax∥ = ∥Σy∥
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 corners (marked points) on the checkerboard
(16 corners in each side of the checkerboard). From the projection matrix you can get the intrinsic
matrix which is indicated as


fx 0 ox
0 fy oy
0 0 1

 (fx and fy are not necessarily be equal).
• Design a function to get the image coordinates of the 32 corners from the image. You can
decide the order of output points for yourself. (2 point)
• Manually (or design a program) to get the world coordinate of the 32 corners. Note that the
output order should be the SAME with the last question. (1 point)
• Design a function to get the intrinsic parameters fx, fy, ox, oy from the image coordinates
and world coordinates acquired above. (2 points)
• Design a function to get the extrinsic parameters R, T from the image coordinates and world
coordinates acquired above. (1 points)
Figure 2: Image of the checkerboard
Instructions (Please read this very carefully!):
• You are only allow to use OpenCV version 4.5.4 for this project.

/• Please implement all your code in file “UB Geometry.py”. Please do NOT make any
changes to any file except “UB Geometry.py”.
• To submit your code and result, Please run “pack submission.sh ” to pack your code and
result into a zip file. You can find the command line in “README.md” Note that when
packing your submission, the script would run your code before packing. The resulting zip
file is only file you need to submit. You should upload the resulting zip file in Brightspace
(UBlearns).
• The packed submission file should be named “submission < Y our UBIT name >.zip”,
and it should contain 3 files, named “result task1.json”, “result task2.json”, and
“UB Geometry.py”. If not, there is something wrong with your code/filename, please go
back and check.
• You are ONLY allowed to use the library that are already imported in the script.
• We grade this project based on the results we get from running your code. If you do not give
correct final results, you are very likely to get NO partial points for that step, even if it may
because you did the former parts wrong.
• Late submissions are NOT accepted.
• Anyone whose raise “RuntimeError”, your grade will be 0 for that task.
• Anyone whose code is evaluated as plagiarism, your grade will be 0 for this project.

软件开发、广告设计客服
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 9951568
© 2021 www.rj363.com
软件定制开发网!