Colorado School of Mines Computer Vision Professor William Hoff Dept of Electrical Engineering &Computer Science Colorado School of Mines Computer Vision http://inside.mines.edu/~whoff/ 1 3D-2D Coordinate Transforms Additional material Colorado School of Mines Computer Vision 2 Special Case – Viewing a Plane • Consider a plane observed from two viewpoints • It can be shown that the image points are transformed using a homography (i.e., an arbritrary 3x3 transformation) image 1 image 0 ~ x1 ~ H ~ x0 2D points in image 1 (homogeneous coords) Colorado School of Mines 2D points in image 0 (homogeneous coords) xa h11 xb h21 x h c 31 Computer Vision h12 h22 h32 h13 x0 h23 y0 h33 1 x1 xa / xc y1 xb / xc 1 1 3 Derivation of Homography • The equation of a plane is n nT P d – where n is the surface normal, P is any point on the plane, and d is the perpendicular distance to the plane – In other words, the dot product of n and P (i.e., the projection of P onto unit vector n) is the distance d • Equivalently, Colorado School of Mines P d nT P 1 d Computer Vision 4 Derivation of Homography (continued) • Consider a point P = (X,Y,Z). If we know the rigid body transformation from camera 0 to camera 1, then 1 P 01 R 0 P 1t 0org • Now, the projection of P onto each image is just p~0 K 0 P, p~1 K 1P • and 0 • So P ~ K 1 p~0 , 1 P ~ K 1 p~1 The notation A ~ B means that A equals B to within an arbitrary scale factor 0 T 0 0 T n P n K 01 R 1t 0org K 1P K 01 R 0 P 1t 0org d d 0 T n 1~ p ~ K 01 R 1t 0org d Colorado School of Mines 0 P 1 0 ~ K p Computer Vision 5 Derivation of Homography (continued) • So 1 p~ ~ M 0 p~ – where M is the homography matrix given by 1 t 0org n 1 K M K 0 R d 1 0 T • • • 0 nT is the surface normal of the plane, expressed in the coordinate system of camera 0 1t 0org is the origin of camera 0, expressed in the coordinate system of camera 1 d is the perpendicular distance to the plane (from camera 0) • Thus, if a plane is observed from two viewpoints, the projected points are transformed from one image to the other with a homography Colorado School of Mines Computer Vision 6 Special Case – Small Planar Patch • Small planar patch – Often we want to track a small patch on an object – We want to know how the image of that patch transforms as the object rotates • Assume – Size of patch small compared to distance -> weak perspective – Rotation is small -> small angle approximation – Patch is planar • It can be shown that the patch undergoes affine transformation xB a11 a12 yB a21 a22 1 0 0 Colorado School of Mines Computer Vision t x x A t y y A 1 1 7 To show this • Write the rotation matrix RzRyRx, but assume that for small angles – cos(theta) ≈ 1 – sin(theta) ≈ theta – theta*theta ≈ 0 Colorado School of Mines Computer Vision Colorado School of Mines Computer Vision Colorado School of Mines Computer Vision