Homework 4 Due Friday, Nov. 17, 9 a.m. Written: (To do some of these, you will probably want to use Matlab, not compute by hand). 1. Compute the F-matrix for a non-verged stereo camera system with 10 micron pixels and a 12.5mm focal length lens. The camera is 600x800 and the center of projection is in the middle of the image. The baseline is 100mm. Assume all external (metric) values are to be in mm. 2. Consider a verged stereo system where the baseline is a distance d along the x axis and the angle of vergence for the right camera is a known angle theta. a) Compute the homogeneous transformation that relates points in left camera coordinates to points in right camera coordinates. b) Compute the form of the E-matrix for this family of stereo rigs. 3. Show the form of the homography relating points on a plane parallel to the image plane, imaged under perspective projection. CS461: 4. The *horopter* is defined as the point of zero disparity (or equivalently, their coordinates in the left and right image are the same). Consider a symmetrically verged stereo rig: that is, one in which both cameras are rotated about the y axis toward each other by the same angle, but with opposite sign. Compute an expression for points on the horopter for this system for all points in the plane y=0. (Hint: just work out projection for a stereo system in the x-z plane with the given geometry and solve for z in terms of x) Implementation: 1. a) Implement a function that given a rotation axis n (a unit vector) and angle a (in radians), computes a 3x3 rotation matrix. You can either implement the Rodrigues form (see http://mathworld.wolfram.com/RodriguesRotationFormula.html) or the equivalent form given in the slides and in Trucco in Verri. Call your function rMat = Rodrigues(axis,angle); b) Implement a function that creates a 4x4 homogeneous transformation from a rotation matrix and a translation vector. Call your function hTrans = HomogeneousTransform(rMatrix,tVector) c) Implement a full perspective projection model (including camera intrinsic parameters). Call your function: pts2D = Perspective(pts3D, intrinsic) where pts2D is a 3xn array of projected points in homogeneous coordinates pts3D is a 4xn array of 3D points in homogeneous coordinates intrinsic is a 3x3 intrinsic parameter matrix === Note that the returned projected points are expected to be in pixel coordinates and are homogenous --- that is, the final coordinate is a 1. 2. Create a simulation of a stereo camera system. To do this, create a stereo camera projection function: [leftPts2D,rightPts2D] = StereoProject(pts3D,intrinsicParms,hTrans) where: leftPts2D and rightPts2D are the projected points pts3D are 3D points to be projected in *left camera coordinates* intrinsicParms is are the intrinsic parameters for both cameras hTrans is the homogeneous transformation that takes points in left camera coordinates to right camera coordinates. 3. Write a function to perform E-matrix (or F-matrix) estimation for a pair of stereo cameras. Call your function eMatrix = EMatrixEstimate(leftPts2D,rightPts2D) where eMatrix is a 3x3 essential matrix leftPts is a 3xn array of points in the left camera rightPts is a 3xn array of corresponding points in the right camera For CS 461 only: 4. Implement homography estimation. Call your function hMatrix = HMatrixEstimate(leftPts2D,rightPts2D) where hMatrix is a 3x3 homography matrix leftPts is a 3xn array of points in the left camera rightPts is a 3xn array of corresponding points in the right camera Submit the following scripts: Problem1.m: a) Create and print the rotation matrix that is a rotation about the vector parallel to v = (1,2,1) and a rotation of .2 radians. Call this matrix R. b) Create and print the homogeneous transform that is formed when combining the rotation in part a) with a translation of 1000 units in the z direction. c) Generate 20 random 3D points in homogeneous coordinates such that abs(x) < 200, abs(y) < 200, abs(z) < 200. Call the points pts3D. Plot these points in figure(1) (use plot3). d) Create a homogeneous transform that moves the points 1000mm along the z direction and rotates them pi/4 radians about the z axis. Computed the transformed points and call them pts3Da. Plot these points in figure(2). e) Project the points in pts3Da using the intrinsic parameters specified for written problem 1. Call the projected points pts2D. Plot these points in figure(3) (using plot). Problem2.m Create two stereo camera systems: a) one that has a baseline translation of 100mm along the x axis and no rotation, and b) one that the same as a, but the right camera is also turned 5 degrees toward the left camera. Now, project the points in pts3Da to produce two pairs of projections [lpts2Da, rpts2Da] and [lpts2Db, rpts2Db]. Print the resulting projections. Problem3.m Estimate and print the F-Matrices for both projections in Problem 2. Compute the corresponding E-Matrices and print them. Problem4.m Repeat the generation of points in problem 1, but now fixing z=0 for all points. Image the points as described in problem 2, and print out the two homographies that result.