$24
Part II Programming Exercises
Problem 1 Single-View Metrology (30 points)
Please use “CIMG6476.JPG” and “kyoto_street.JPG” as the inputs. You can only use the following Python libraries: OpenCV, NumPy, math, matplotlib, and SciPy.
(a) For the Kyoto Street image, shown above, estimate the positions (in the image plane) of the three major orthogonal vanishing points (VPs), corresponding to the building orientations. Use at least three manually selected lines to solve for each vanishing point. The included code getVanishingPoint.py provides an interface for selecting and drawing the lines, but the code for computing the vanishing point needs to be inserted.
3
◦ Plot the VPs and the lines used to estimate them on the image plane. (1 pts)
◦ Specify the VPs (u, v). (1 pts)
◦ Plot the ground horizon line and specify its parameters in the form au + bv + c = 0. Normalize the parameters so that: a2 + b2 = 1. (3 pts)
(b) Use the fact that the vanishing points are in orthogonal directions to estimate the camera focal length (f) and optical center (u0, v0). Show all work. (5 pts)
(c) Show how to compute the camera’s rotation matrix when provided with vanishing points in the X, Y, and Z directions. (5 pts)
Now, compute the rotation matrix for this image, setting the vertical vanishing point as the Y-direction, the right-most vanishing point as the X-direction, and the left-most vanishing point as the Z-direction. (5 pts)
4
(d) The above photo is of the University High building, taken from the third floor in Siebel Center facing south. Estimate the horizon and draw/plot it on the image. Assume that the sign is 1.65m. Estimate the heights of the tractor, the building, and the camera (in meters). This can be done with PowerPoint, paper and a ruler, or Python.
◦ Turn in an illustration that shows the horizon line, and the lines and measurements used to estimate the heights of the building, tractor, and camera. (5 pts)
◦ Report the estimated heights of the building, tractor, and camera. (5 pts)
5