Projective Geometry CS 4495/7495 Computer Vision Frank Dellaert, Fall 07 Photographs are Projections Vertical vanishing point (at infinity) Vanishing line Vanishing point Slide Courtesy Antonio Criminisi Vanishing point 2D Coordinate Frames & Points • coordinates x and y j x = op ! i p =(x,y)T y = op ! j i o 2D Lines • Line l = ax+by=c j p=(x,y)T c (a,b)T i Homogeneous Coordinates • Uniform treatment of points and lines j • Line-point incidence: lTp=0 stay the same when scaled: p=(x,y,1)T~(kx,kx,k)T c l=(a,b,c)T~(ka,kb,kc)T (a,b)T i Join = cross product ! • Join of two lines is a point: p=l1xl2 • Join of two points is a line: l=p1xp2 Automatic estimation of vanishing points and lines Joining two parallel lines ? (a,b,c) i j k &bd ' cb # p = a b c = $$ca ' ad !! a b d $% 0 !" (a,b,c) (a,b,d) Points at Infinity ! (-b,a,0)T Line at infinity linf=(0,0,1)T j l=(a,b,c)T i (-b,a,0)T Method 1: Determinants • 2D Line between two 2D points – Point x on l must be linear comb of p1 & p2: xT x p1T = x1 p2T x2 y y1 y2 w w1 = 0 " x = p1 ! p2 w2 cameras01.m Method 2: Homogenous Equations • we want lTp=0 for all lines !: &l1T # &0 # $ T ! &x# $ ! l 2 ! $ ! $0 ! $ Ap = T ' $ y ! = $l3 ! $0 ! $ T ! $% w!" $ ! $%l4 !" %0 " Live Demo! cameras02.m cameras03.m Solving Homogeneous Equations • Much nicer than in book: 2 Ap = USV p &l1T # &0 # $ T ! &x# $ ! l 2 ! $ ! $0 ! $ Ap = T ' $ y ! = $l3 ! $0 ! $ T ! $% w!" $ ! $%l4 !" %0 " 2 = p T VS T SV T p write x =VT p arg min xT S T Sx 2 arg min Ap s.t. p = 1 T ! ! x = (0,0,...,1)T SVD Figure A=U S VT 4x4 3 R column space 4x3 3x3 2 3 =P R row space nullspace(AT) R nullspace(A)=empty 3d eigenvector smallest contribution Fundamental Theorem (Strang) Ax x x+y y Strang Course 18.06 Linear Algebra, on MIT OpenCourseWare, ocw.mit.edu Ax Applied to line fitting & x1T # $ T! $ x2 ! $ x3T ! $ T! $ x4 ! a $ xT ! & # $ 5T ! ' $b ! = 0 $ x6 ! $ ! $ xT ! $% c !" $ 7! $ x8T ! $ T! $ x9 ! $% x10T !" cameras04.m Caveat: Normalization matters ! Hierarchy of 2D Transforms • Subgroup Structure: – Translation (2DOF) – Rigid 2D (3DOF) – Affine (6DOF) – Projective (8DOF) Rigid 2D Transform • Take Notes A special case, planes Homography matrix (3x3) Observer 2D Image plane (retina, film, canvas) 2D World plane A plane to plane projective transformation Homography • Take Notes •u= •v= Analysing patterns and shapes What is the shape of the b/w floor pattern? y h p a r og m o H The floor (enlarged) Automatical ly rectified SVD For Homography • Cross-product Trick • Take Notes In 3D: Same Story • • • • • 3D points: (x,y,z,w)T 3D planes: (a,b,c,d)T join of three points = plane join of three planes = point plane at infinity: (0,0,0,1)T Join of 3D points X Y PT X 1 Y1 P1T = T X 2 Y2 P2 X 3 Y3 P3T Z T Z1 T1 =0 Z 2 T2 Z 3 T3 Determinant minors: (analog of cross product) Y1 X Y2 Y3 Z1 T1 X1 Z 2 T2 ! Y X 2 Z 3 T3 X3 Z1 T1 X1 Z 2 T2 + Z X 2 Z 3 T3 X3 Y1 T1 X1 Y2 T2 ! T X 2 Z 3 T3 X3 Y1 Y2 Z3 Z1 Z2 = 0 Z3 Plane fitting &a # &X # $ ! $ ! $b ! $X ! ' $c ! = 0 $X ! $ ! % " d % " T 1 T 2 T 3 cameras05.m Hierarchy of 3D Transforms • Subgroup Structure: – Translation (3DOF) – Rigid 3D (6DOF) – Affine (12DOF) – Projective (15DOF) Rigid Body Transformations • Need a way to specify the six degreesof-freedom of a rigid body. • Why are their 6 DOF? A rigid body is a collection of points whose positions relative to each other can’t change Fix one point, three DOF Fix second point, two more DOF (must maintain distance constraint) Third point adds one more DOF, for rotation around line Notations • • • Superscript references coordinate frame AP is coordinates of P in frame A BP is coordinates of P in frame B • Example : " A x% $A ' A P = $ y ' ( OP = $ A z' # & kA ! iA OA ! ! ! ! jA P ( A ) ( x • iA + A ) ( y • jA + A z • kA ) Translation B A B P= P+ (OA ) kB ! kA ! iA OA ! jA ! ! iB ! P ! ! ! OB jB Translation • Using homogeneous coordinates, translation can be expressed as a matrix multiplication. B P = A P + BO A ! B P" ! I # $=# %1 & % 0 B OA " ! A P " $# $ 1 & %1 & • Translation is communicative Rotation uuuv OP = (i A jA B B A R ! Ax " #A $ k A )# y $ = (iB # Az $ % & jB ! Bx " #B $ k B )# y $ # Bz $ % & P = AB R A P means describing frame A in The coordinate system of frame B Rotation ! i A .i B B # i .j R = A # A B #% i A .k B = !# B i A jA .i B j A . jB jA .k B B jA k A .i B " k A . jB $ $ k A .k B $& B k A "$ ! A iTB " #A T$ = # jB $ # A k TB $ % & Orthogonal matrix! Example: Rotation about z axis What is the rotation matrix? Rotation in homogeneous coordinates • Using homogeneous coordinates, rotation can be expressed as a matrix multiplication. B B A A P= R P ! B P " ! AB R 0" ! A P " # $=# $# $ %1 & % 0 1& %1 & • Rotation is not communicative Rigid transformations B B A A B P = R P + OA Rigid transformations (con’t) • Unified treatment using homogeneous coordinates. ! B P " !1 # $=# %1 & %0 ! AB R =# T %0 B O A " ! AB R 0" ! A P " $# $# $ 1 & % 0 1& %1 & B OA " ! A P " $# $ 1 & %1 & ! B P " B ! AP " # $ = AT # $ %1& %1&
© Copyright 2026 Paperzz