
CMSC828D: Homework 9: Optimization and Stereo
1. Indicate how you would fit a quadratic to a function f(x,y) if you know its values,
fi, at six points on the plane, (xi,yi). ( a0 + a1x+ a2y+a3xy+a4x2+a5y2). Write a
function in Matlab that implements your algorithm. How would you use your
function to compute derivatives? Are there any degenerate configurations that
would make your function fail? Your function should treat these cases as well.
2. If you now had more than six points you could “fit” a surface to these points using
least squares. Write down your distance function. Solve the least squares problem
using the SVD algorithm described in class. Modify your Matlab function. (you
may not use any canned fitting function in Matlab).
3. Generate several points along an ellipsoidal surface given by
z=((x-2)2+(y-3)2)1/2+2
by letting x vary from –2:0.2:2 and y vary from –3:.3:3. Add Gaussian noise of
variance 0.2 to your z vector using the Matlab function randn. Test your
function on this dataset.
4. Now you are given standard deviations for the z variable σi. Modify your
function in Question 2 for this case.
5. Write functions to compute the SSD score and the cross-correlation score for
candidate matches in a pair of stereo images. Test your function on row 15 of the
given left and right images from a stereo camera. (You can obtain the images at
http://www.umiacs.umd.edu/~ramani/imageL.tif and
http://www.umiacs.umd.edu/~ramani/imageR.tif. These are respectively the left
and right images, and are rectified.) The maximum disparity is 11 pixels.