EN161 Image Understanding
Assignment 3: Image Formation

Due : Wed., Oct. 5

  
Notes
  • In this lab you will be working on image formation from 3D objects. The purpose is to illustrate how the camera geometry, and radiometry jointly determine how the image looks. 
 
Camera Geometry and Image Formation
For this experiment you will use the 3D object (head) shown below. To download a subsampled set of 3D data points, click. The data set consists of 4000 lines of (X,Y,Z) coordinate points. For all problems attach your MATLAB code and print output images.
Download the MATLAB routine niceplot.m by clicking and view the 3D data set. 

 

Problem 1:  (X,Y,Z) coordinates of the points of the head are given in centimeters, the focal length is 65mm, the square pixel dimensions are 0.25mm in horizontal and vertical directions, and the camera coordinate center is located at (0,0,0) with the optical axis looking along the +z axis.
What is the image size in pixels in horizontal and vertical directions of the 3D set of points under a perspective projection
What is the image size in pixels in horizontal and vertical directions of the 3D set of points under a weak perspective projection

Hint: To do this write a MATLAB function which will take input parameters and return output parameters! This function will compute the set of (x,y) points on the image plane under a perspective projection from the set of (X,Y,Z) points in space given an arbitrary focal length and pixel size. Arbitrary means that your function must take these values as parameters, they can't be constants built into your code. This will allow you to reuse the same code with different parameter values for the following problems. You have to write another function that does the same thing for a weak perspective projection.

Problem 2: Using the above focal length and pixel size, form the binary image for the 3D object under perspective projection.
Why don't we get a solid binary shape in the images? Now try pixel dimension 1mm in horizontal and vertical directions only for perspective projection. Explain the difference. 

Hint: You have to convert the (x,y) values you get to an image. Start with a blank image (all black) that is the size of the minimum box that will include all (x,y) points. Put white pixels at each (x,y) location. Remember images can't have negative or zero indices so you will have to shift all (x,y) values so that the minimum x value and the minimum y value will be 1. 

Problem 3: Translate the data by (0,0,-60). Rotate the object 90 degrees about the Y axis, then -30 degrees about the X axis, then -90 degrees about the Z axis and finally translate it by (0,0,50). Form the binary image using the perspective and the weak perspective camera model.  Explain the differences in the two images.

Hint: Use rotation matrices to do the rotations!

Problem 4:  Do the same transformations as in Problem 3 except change the last translation to (0,0,200) instead of (0,0,50). Form the two images again. Use pixel size 0.1mm. Why do the two images look more similar now, then in Problem 3? 



 

The coordinates for the points are as follows
P1 = (0,0,0), P2 = (30,0,0), P3 = (0,40,0), P4 = (30,40,0), P5 = (15,60,0), P6 = (30,0,50), P7 = (30,40,50), P8 = (15,60,50).

Problem 5: The 3D house in the figure has the corner point coordinates as given above in the (X, Y, Z) coordinate system.  Translate the coordinates by (-15,-30,-25). Rotate by 180 degrees about the Z axis, then -30 degrees about the X axis, then -30 degrees about the Y axis followed by a translation of (0,0,60). Generate the central perspective image of the house, use focal length 30mm.  Use square pixel size of 0.1 mm. Now, show that each group of parallel lines in 3D converge to a point in the image (vanishing point).

Hint: Use rotation matrices! To draw the house first project the (X,Y,Z) points to the image plane to find corresponding (x,y) points. Then connect appropriate points with lines. (You should also implement a line drawing function which will take 2 input points. The function will draw the line defined by input points.)

Hint2: To find the vanishing points extend the sides of the house with a ruler and a pencil.
Note that the following groups of lines are parallel (// means the lines are parallel)
1. |P1P3| // |P2P4| // |P6P7|,
2. |P1P2| // |P3P4|, 
3. |P2P6| // |P4P7| // |P5P8|, 
4. |P4P5| // |P7P8|

Problem 6: Assume for a plane not parallel to the image plane, there are 3 or more sets of parallel lines. There is a vanishing point for each of these sets of parallel lines. What can you say about the geometry of these vanishing points? That is, do these points lie on a simple curve? Explain.

 

Radiometry and Image Formation

Problem 7: Given a Lambertian (matte) sphere, center (0,0,40) and radius 10, form its gray level image under the following assumptions:

1. The focal length is 65mm, the square pixel dimensions are 0.25mm in horizontal and vertical directions, and the camera coordinate center is located at (0,0,0) ,
2. A point light source is located also at (0,0,0) ,
3. The sphere has constant albedo ,
4. Image intensity quantized to 255 gray levels. Assume that the brightest image pixel has intensity 200, and image points which do not correspond to any 3D sphere point will have intensity 0, 
5. Image irradiance is proportional to scene radiance.

Hint: First generate a reasonable sampling of points on the sphere using the parametric sphere equations. These are: 
X(u,v)=Rsin(u)cos(v), Y(u,v)=Rsin(u)sin(v), Z(u,v)=Rcos(u)+40 
where R=10 is the fixed radius and u is an angle that runs 0 to pi and v is an angle that runs from 0 to 2pi. The sphere is the collection of points (X(u,v),Y(u,v),Z(u,v)). You should try 100 step sampling for u and v. If you increase this number you will obtain better looking results, but your programs will be very slow. Then compute the surface normal at each point. The surface normal at a point on the sphere is simply given by the vector joining the point to the center of the sphere.

Problem 8: Solve Problem 7 with the point light source located in the direction of (-1,0,-1)and far from the camera. With this point source at infinity, all the rays from the source will be parallel. 

Problem 9: What do the constant intensity regions look like in Problem 7 and Problem 8 ?
Hint: Take a pair of thresholds close together and plot image points having intensities lying between those thresholds.