Lecture No. 2-6 Perspective Transformation (course: Computer Vision) e-mail: naeemmahoto@gmail.com Department of Software Engineering, Mehran UET Jamshoro, Sind, Pakistan
3-D Imaging Transformation A 3D projection is a mathematical transformation used to project three Dimensional points onto a two Dimensional plane This is done to simulate the relationship of the camera to subject 3D projection is often the first step in the process of representing three dimensional shapes, two dimensionally in computer graphics, a process known as rendering
There are two basic ways for projecting 3-D objects onto a 2-D plane:. Parallel Projection 2. Perspective Projection 3-D Imaging Transformation Parallel Projection: Linear transforms (implemented with the help of Matrices), that are useful in blue prints, schematic diagrams etc Perspective Projection: Non-Linear transforms, can be implemented with a matrix in projective space, followed by a divide by homogenous coordinate Useful in Architectural rendering, realistic views etc
Imaging Transformation Process
Perspective Transformation A perspective transformation (Imaging transformation) projects 3-D points onto a 2-D plane Lets assume that, the camera co-ordinate system (x, y, z) has the image plane coincident with the xy-plne and the optical axis (established by the center of lens) along the z-axis Thus the center of Image Plane is at the Origin For Projection, there are two possible scenarios, including:. When the Origin is at the Lens Center 2. When the Origin is moved to the center of Image plane
Perspective Transformation Origin at Lens center Lens 3D world (X,Y,) Image plane y f ( O Pin hole camera )
Perspective Transformation X Y -y f -x ( ) By Using the concept of Similar triangles, we have: -ve signs shows that Image points are Inverted. y f x f Y X y f x f Y X
Perspective Transformation Now,if the Origin is moved to the center of Image plane, then the center of the lens is located at coordinates (,,) Origin at Image center Lens 3D world (X,Y,) If the camera is in focus for distant objects, is the focal length of the lens Image plane O y Pin hole camera
Perspective Transformation X Y -y -x ( ) - By Using the concept of Similar triangles, we have: -ve signs shows that Image points are Inverted. y Y Y y x X X x
Perspective Transformation Thus we have projected a 3-D object on 2-D Image plane, and it is given by: ( x, y) ( X Y, ) These equations are Non Linear due to division by Remember that, the third dimension is lost during Image formation! It does play an Impact during Image formation, as (x, y) are dependent upon
Perspective Transformation
Homogenous Transform To represent the (x, y) in Linear matrix form, we may use the concept of Homogeneous coordinates Homogeneous coordinates of a point (X,Y,) are given as (kx,ky,k,k), where k is an arbitrary non-zero constant X w Y World coordinate Catesian kx ky Wh Homogeneous k k World coordinate in Homogenous form
Inverse Homogenous Transform The Inverse homogeneous transform converts homogenous coordinates back into Cartesian coordinates (Ch, ch2, ch3) = (ch/ch4, ch2/ch4, ch3/ch4) (X, Y, ) = (KX/K, KY/K, K/K) Wh kx ky k k Homogeneous X w Y Catesian World coordinate in Homogenous form World coordinate
The Transformation matrix for Perspection is denoted by P and given by: Perspective Projection using Homogenous coordinates / P
Then the product P*Wh yields a vector denoted by C h : Perspective Projection using Homogenous coordinates / Ch k k ky kx Ch = P * Wh Ch represents the Camera co ordinate in Homogeneous form k k k ky kx Ch ) / (
The elements of C h are the camera coordinates in homogeneous form Dividing first three components C h of by fourth can form Cartesian coordinates Therefore in Cartesian form Perspective Projection using Homogenous coordinates ) /( ) /( ) /( Y X z y x C
Perspective Projection using Homogenous coordinates The third component is of no interest as it is lost while projection on image plane x X /( ) and y Y /( )
The Inverse Perspective transformation can be used to map an Image point back into 3D space The Inverse Perspective Transformation Matrix is given by: Inverse Perspective Projection Since Ch=P Wh Therefore Wh=P - Ch / P
Inverse Perspective Projection If there is an Image point given by (x o,y o,), where = indicates the fact that Image plane is located at z= This point can be represented in homogeneous form as: C h = kx ky k Now we can apply Inverse Perspective Transform on Ch
Inverse Perspective Projection / k kyo kxo = W h = W h P - C h k kyo kxo W h = Y X W = = yo xo
Inverse Perspective Projection This is obviously not, what one would expect, since it gives = for any 3D point The problem here is caused by the fact that mapping a 3D scene onto the Image Plane is a many-to-one transformation The image point (x o,y o ) corresponds to a set of collinear points that lie on the line that passes through (x o,y o,) and (,, )
Inverse Perspective Projection The equations of this line in the world coordinate system are obtained as: X=xo/ ( -) Y=yo/ ( -) These equations show that: Unless we know something about the 3D point that generated a given Image point (for example, its coordinate), we cannot completely recover the 3D point from its Image.
The above observation, can be used to formulate the Inverse Perspective transformation by using the component of Ch as a free variable, instead of Thus, let Inverse Perspective Projection kx ky kz = k C h / k kz kyo kxo = W h = W h P - C h
Inverse Perspective Projection W h = Y X W = = k kz kz kyo kxo / z z z yo z xo / / /
In simple words, treating as a free variable yields the following equations: X = Y = = / xo z yo / z z / z Inverse Perspective Projection Finally, for solving z in terms of in last equation, and substituting values in the first two expressions, yield: X = xo( -)/ Y = yo( -)/ This agrees with the observation that recovering a 3D point from its Image by means of Inverse Perspective transformation requires knowledge of at least One of the world coordinate of the point