university of cambridge engineering part iib module 4f12
play

University of Cambridge Engineering Part IIB Module 4F12: Computer - PDF document

University of Cambridge Engineering Part IIB Module 4F12: Computer Vision Handout 3: Projection Roberto Cipolla October 2020 Projection 1 Orthographic projection Recall that computer vision is about discovering from images what is present


  1. University of Cambridge Engineering Part IIB Module 4F12: Computer Vision Handout 3: Projection Roberto Cipolla October 2020

  2. Projection 1 Orthographic projection Recall that computer vision is about discovering from images what is present in the scene and where it is. If we are going to successfully invert the imaging process, we need to understand the imaging process itself. In mechanical drawing, we have already seen how to construct images of 3D scenes using orthographic projection : we project the scene onto an image plane using parallel rays. Image plane A a B b World object c (x,y,0) C (X,Y,Z) X x k O viewing direction x = X − ( X . k ) k = ( k × X ) × k

  3. 2 Engineering Part IIB: 4F12 Computer Vision Orthographic projection Some of the images which we take with CCD cameras do, indeed, look as if they have been formed by orthographic pro- jection. The image on the left resembles an orthographic pro- jection. Parallel lines in the scene appear as parallel lines in the image, and length ratios along parallel lines are preserved. Orthographic? Certainly not orthographic However, some CCD images are not explained by orthographic projection. In the image on the right, parallel lines in the scene appear to converge in the image. We clearly need a more general model of projection to explain what is happening in CCD cameras.

  4. Projection 3 Perspective projection The projection model we adopt is inspired by the pin-hole camera . The figure below illustrates the operation of the pin-hole camera in three dimensions. X c X Optical axis Image plane Z x Y p f Z c X World coordinates Optical centre X c Camera-centered Y c coordinates The notation we adopt is X c = ( X c , Y c , Z c ) for the visible world point, and x = ( x, y ) for the corresponding image plane point, both measured in the camera-centered coordinate sys- tem ( Z c along the optical axis).

  5. 4 Engineering Part IIB: 4F12 Computer Vision Perspective projection The figure below illustrates the operation of the pin-hole cam- era in two dimensions ( Y c = 0). X c World point (X ,0, Z ) Z c c c Optical centre x f O c Image Optical axis f Focal length Real image in a Image plane pin-hole camera By analysing the similar triangles, we find that f = X c x ⇔ x = fX c Z c Z c For the three-dimensional case, we also have y = fY c Z c This type of projection is called planar perspective pro- jection.

  6. Projection 5 Projection examples (a) Circle in space, radius a , orthogonal to the optical axis and centered on the optical axis. Z c X c Circle Image Y c f Optical centre Z 0 X c = ( a cos θ, a sin θ, Z 0 )  fa cos θ , fa sin θ   x =  Z 0 Z 0 So the image is a circle of radius fa/Z 0 . The scaling is inversely proportional to the distance of the circle from the optical cen- tre. (b) Move the circle in the X c direction. X c = ( a cos θ + X 0 , a sin θ, Z 0 )  fa cos θ + fX 0 , fa sin θ   x =  Z 0 Z 0 So the image is still a circle of radius fa/Z 0 , though the centre of the circle has moved in the image plane.

  7. 6 Engineering Part IIB: 4F12 Computer Vision Vanishing points As we shall shortly see, a circle does not always project to a circle. An important property of perspective projection is the existence of vanishing points . These are points in the image where parallel lines appear to meet. Vanishing point O v c Parallel lines Ground plane Each set of parallel lines in the world will have a different vanishing point in the image. vp1 vp2 horizon

  8. Projection 7 Vanishing points Similarly, parallel planes in the world meet in a line in the image, often called a horizon line . Any set of parallel lines lying on these planes will have a vanishing point on the horizon line. Renaissance painters used perspective constructions to intro- duce a new realism into art (Masaccio’s - Trinity (1427)).

  9. 8 Engineering Part IIB: 4F12 Computer Vision Properties of perspective projection Armed with the concept of vanishing points, we can now con- struct the projection of a circle which is not parallel to the image plane. The circle example reveals that ratios of lengths and areas are not preserved under perspective projection. Neither is symmetry.

  10. Projection 9 Vanishing points Example. Derive the image location x vp of the vanishing point for a line in the world. X c = a + λ b  a x + λb x , a y + λb y   ⇒ x = f  a z + λb z a z + λb z As λ → ∞ , we move further down the line, and x converges to the vanishing point:  b x , b y   x vp = f  b z b z As expected, the vanishing point depends only on the line’s orientation and not its position. When b z = 0, the line is parallel to the image plane and the vanishing point is at infinity. Note that the axes we have defined are relative to the camera, so when b z = 0, the line has no component along the cam- era’s z -axis (the optical axis). With a horizontal camera, the image plane is vertical and so vertical lines in the world have a vanishing point at infinity. If the camera is not horizontal, vertical lines in the world will have a vanishing point in the image.

  11. 10 Engineering Part IIB: 4F12 Computer Vision Vanishing points Here’s an example of an image with converging vertical lines. The Tower of Babel , by Maurits Escher

  12. Projection 11 Full camera model A full camera model describes the mapping from world to pixel coordinates. It must account for the following transformations: • The rigid body motion (an isometry) between the camera and the scene; • Perspective projection onto the image plane; • CCD imaging — the geometry of the CCD array (the size and shape of the pixels) and its position with respect to the optical axis. Array centered on optical axis Array not centered on optical axis Square pixels Rectangular pixels

  13. 12 Engineering Part IIB: 4F12 Computer Vision Full camera model To model the rigid body motion, we attach a coordinate system X = ( X, Y, Z ) to the world, and another coordinate system X c = ( X c , Y c , Z c ) to the camera. R rotation (3 dof) Z Y Z c X World T translation coordinates (3 dof) X c Camera-centered Y c coordinates The rigid body motion can be described by a rotation matrix R and a translation vector T :         X c r 11 r 12 r 13 X T x                 Y c  = r 21 r 22 r 23 Y  + T y                         Z c r 31 r 32 r 33 Z T z       X c = R X + T

  14. Projection 13 Full camera model As introduced before, planar perspective projection onto the imaging surface is modelled by: x = fX c Z c y = fY c Z c X c X Optical axis Image plane Z x Y p f Z c X World coordinates Optical centre X c Camera-centered Y c coordinates

  15. 14 Engineering Part IIB: 4F12 Computer Vision Full camera model To model CCD imaging, we define pixel coordinates w = ( u, v ) in addition to the image plane coordinates x = ( x, y ). u (0,0) (511,0) v x CCD array (511,511) (0,511) Optical axis y (u , v ) 0 0 Image plane w and x are related as follows: u = u 0 + k u x , v = v 0 + k v y The overall mapping from world coordinates X to pixel coor- dinates w = ( u, v ) is u = u 0 + k u fX c = u 0 + k u f ( r 11 X + r 12 Y + r 13 Z + T x ) Z c r 31 X + r 32 Y + r 33 Z + T z v = v 0 + k v fY c = v 0 + k v f ( r 21 X + r 22 Y + r 23 Z + T y ) Z c r 31 X + r 32 Y + r 33 Z + T z

  16. Projection 15 Homogeneous coordinates The expressions at the foot of page 14 are messy! Homo- geneous coordinates offer a more natural framework for the study of projective geometry. The imaging process can be expressed as a linear matrix operation in homogeneous coor- dinates. Furthermore, a series of projections can be expressed as a single matrix operation. We usually express the location of a point in Cartesian coor- dinates. In 2D space, for example, we would use coordinates x = ( x, y ). Cartesian coordinates become cumbersome when dealing with points at infinity, a crucial ingredient in the pro- jection process. The Cartesian coordinates of a point at infin- ity are in general both infinite but have a definite ratio x/y , depending on the direction of the point from the origin. Cal- culation with infinite quantities of this kind is confusing, and it is convenient to represent each point not by two numbers x = ( x, y ) but by three numbers ˜ x = ( x 1 , x 2 , x 3 ) such that      x  x 1 /x 3  =     y x 2 /x 3 

Recommend


More recommend