1
CSE 152 Assignment 1 : Solutions Introduction to Computer Vision Winter 2019
Camera Matrices and Rigid-Body Transformations
(a) There are two vectors orthogonal toi′ andj′. One is a =i′ ×j′, the other is b =i′ ×j′ = −a. Computing the cross-product, we have a = (−0.1225, −0.1493, 0.9812)⊤. Let θa be the angle between a and k′. Then, we have
cos θa = a · k = (−0.1225, −0.1493, 0.9812)⊤ · (0, 0, 1)⊤ = 0.9812. Since cosθa > 0, we have |θa| < 90◦, so we choose k′ = a.
(b) From the lecture notes, such a rotation matrix is
i′⊤ 0.9 0.4 0.1732 ′⊤
R = j = −0.41833 0.90427 0.08539 . k′⊤ −0.1225 −0.1493 0.9812
(c) The camera center is given by C = (−1, −2, −3)⊤ in world coordinates. From the lecture notes, the extrinsic parameter matrix is given by
0.9 0.4 0.1732 2.2196
R −RC −0.41833 0.90427 0.08539 1.6464 ⊤=.
0 1 −0.1225 −0.1493 0.9812 2.5224 0001
(d) From lecture notes, the intrinsic parameter matrix is given by
−1050 0 −10 0 −1050 5 .
001
You might have chosen a different convention and have entries for the focal lengths and principal point negated. That is fine and also an acceptable answer.
(e) From lecture notes, the projection matrix is given by
−943.775 −418.507 −191.672 −2355.804 P = K [R| − RC] = 438.634 −950.230 −84.754 −1716.108 .
−0.123 −0.149 0.981 2.522
If you had chosen the other convention for the intrinsic parameter matrix, you would obtain
negatives of the above in the first two rows. As above, that is acceptable.
(f) The obtained image of the circle should be an ellipse.
1
2
Epipolar Geometry
(a) Try to click the points accurately. See Figure 1 and Figure 2.
Figure 1: Points clicked for blocks data.
Figure 2: Points clicked for desk data. (b) Fundamental matrix for blocks:
0.0000 −0.0000 0.0407
F = 0.0000 −0.0000 −0.0126 . (1)
−0.0570 0.0179 0.9973
Fundamental matrix for desk:
F = −0.0004 −0.0000 0.0094 . (2)
0.0002 0.0005 −0.6522 0.6212 0.0080 −0.4343
(c) Epipolar lines in the left image are given by l = F⊤x′ and those in the right image are given by l′ = Fx. See Figure 3 and Figure 4.
(d) Epipoles for blocks:
Left: e = (0.2996, 0.9541, −0.0000)⊤. Right: e′ = (−0.2957, −0.9553, 0.0000)⊤.
Epipoles for desk:
Left: e = (0.0123, −0.9999, −0.0008)⊤. Right: e′ = (0.0140, 0.9999, 0.0006)⊤.
2
3
Figure 3: Epipolar lines for blocks data.
Figure 4: Epipolar lines for desk data.
Figure 5: SIFT matches for road data. Feature detection, matching and RANSAC
(a) You should obtain a plot of matches similar to Figure 5.
(b) Youmightgetapoorfundamentalmatrixestimatehere,sinceoutliershavenotbeenremoved.
Epipolar lines might not appear to pass through corresponding points.
(c) For “left” image given by road1.png and “right” image given by road2.png, the estimated fundamental matrix:
−5.037 × 10−7 F = 4.976 × 10−4
−4.971 × 10−4 6.165 × 10−6 0.309
0.084 −0.313 .
−0.084
You might have reported your estimate without normalization (recall that the fundamental
3
1
Figure 6: Epipolar lines for road data.
matrix is a homogeneous entity whose scale does not matter). That is fine, but the overall trends should be similar if your estimate is correct. You might have chosen the reverse definitions of left and right images, in which case you should obtain the transpose of the above F.
The epipoles are given by e = (626.7, 167.6, 1)⊤ in the left image and e′ = (623.9, 169.9, 1)⊤ in the right image.
Figure 6 shows the estimated epipolar lines at five randomly chosen points, obtained as l = F⊤x′ in the left image and l′ = Fx in the right image, for points x in the left image and x′ in the right image.
(d) The two images depict almost purely forward motion. Thus, the image of the right camera center must be somewhere inside the left image and most likely at a point close to the center of the let image. Similarly for the image of the left camera center in the right image. All epipolar lines must pass through the epipole. In Figure 6, we can see that epipolar lines do indeed pass through a point roughly near the center of the image.
(e) Note that each row of the A matrix in the 8-point algorithm contains some entries such as uu′, some entries such as u and the last column is 1. Typical points in the images have coordinates of size O(100). Thus, the entries of A range in size from O(1) to O(10000). This makes |bA an ill-conditioned matrix and leads to unstable estimation.
We note that multiplying image coordinates by K−1 will bring the coordinates of each point roughly within a range [−1, 1]. Thus, let B = K−1 and normalize the points as y = Bx
4
and y′ = Bx′. We estimate a fundamental matrix using y and y′, call it F′. Then, we have y′⊤F′y = 0, which leads to x′⊤B⊤F′Bx = 0, by substitution. But for the original points, we also have x′⊤Fx = 0. By comparing the two previous expressions, we obtain F = B⊤F′B.
Thus, we normalize the point using B = K−1, compute a fundamental matrix F′ using the same RANSAC with 8-point algorithm procedure and obtain the desired fundamental matrix as F = B⊤F′B.
5