Lab 5: 3D projective geometry and stereo

428/615, Martin Jagersand

Submit code and report electronically through the upload link on the e-Class course webpage.
Marks may be given for any of the questions in the assignment, so please answer them all
(many only require a one sentence answer).
Demo: In your lab session.


Exercise 1: Homogeneous transforms and projections (3)

References: lec06GeomIntro.pdf slides 51-58, Equations of Lines and Planes , Parametric Equation of a Circle

In Matlab, define 3D geometric point "clouds" defining a line, rectangle, circle, and the wireframe edges of a box or cube.

Hint:Use the rand function and transform the resulting uniform distributions so they extend over a line, square etc...
You can check your results using the 3d plotting: "plot3"

Define the transforms below using homogeneous coordinates and project each shape above and image (using regular 2D "plot(u,v,'.')") the result under:
 

Note: Place the camera somewhere outside of the scene so all the points are visible.
Exercise 2: Camera geometry and stereo (7)

References: lec06GeomIntro.pdf slide 68, and lect16.pdf (external) slides 12 - 14

a. Focal length (1)

Determine the focal length of the camera using a picture of a ruler placed at a known depth from the camera, parallel with the camera plane. Use 2 or more images and pick the best result. Note that the focal length that you obtain will be measured in pixels.

Hint: Use similar triangles formed with the ruler and its projection in the image; measure the dimension of the sampled line in 3D and image.

 b. Determine the 3D structure of a box object using stereo with 2 images (2)

c. Determine the 3D structure of a box object using stereo with a set of images (4)

    Synthetic data       Real data

In addition to your own captured data, you can use this sample pattern sequence (Stereo.mat) to test your program.

Getting data to matlab: load Stereo
We tracked NrPoints = 16 points on a calibration pattern in NrFrames=9 frames. Here is an image of the pattern and the tracked points. The camera was moved on a line perpendicular to camera axis and the frames are taken at d = 5cm intervals along the line. You can choose f = 100.  We stored the tracked points in W of size 2*NrFrames x  NrPoints where row i:  represents the horizontal coordinate (u) of the points row i+NrFrames: represents the vertical coordinate (v) of the points