Image Formation Fundamentals Basic Concepts (Continued…) How are images represented in the computer? courstey UNR computer vision course Image digitization • • Sampling means measuring the value of an image at a finite number of points. Quantization is the representation of the measured value at the sampled point by an integer. courstey UNR computer vision course Image digitization (cont’d) courstey UNR computer vision course Image quantization (Example) 256 gray levels (8bits/pixel) 32 gray levels (5 bits/pixel) 16 gray levels (4 bits/pixel) 8 gray levels (3 bits/pixel) 4 gray levels (2 bits/pixel) 2 gray levels (1 bit/pixel) courstey UNR computer vision course Image sampling (example) original image sampled by a factor of 4 sampled by a factor of 2 sampled by a factor of 8 courstey UNR computer vision course Digital image • An image is represented by a rectangular array of integers. • An integer represents the brightness or darkness of the image at that point. • N: # of rows, M: # of columns, Q: # of gray levels – N = 2 n , M = 2 m , Q = 2 q (q is the # of bits/pixel) – Storage requirements: NxMxQ (e.g., N=M=1024, q=8, 1MB) f (0,0) f (1,0) ... f ( N 1,0) f (0,1) f (1,1) ... f ( N 1,1) ... ... ... ... f (0, M 1) f (1, M 1) ... f ( N 1, M 1) courstey UNR computer vision course Image formation • There are two parts to the image formation process: – The geometry of image formation, which determines where in the image plane the projection of a point in the scene will be located. – The physics of light, which determines the brightness of a point in the image plane as a function of illumination and surface properties. courstey UNR computer vision course A Simple model of image formation • The scene is illuminated by a single source. • The scene reflects radiation towards the camera. • The camera senses it via chemicals on film. courstey UNR computer vision course Pinhole cameras • Abstract camera model - box with a small hole in it • Pinhole cameras work in practice courstey Dr. G. D. Hager Real Pinhole Cameras Pinhole too big many directions are averaged, blurring the image Pinhole too smalldiffraction effects blur the image Generally, pinhole cameras are dark, because a very small set of rays from a particular point hits the screen. courstey Dr. G. D. Hager The reason for lenses Lenses gather and focus light, allowing for brighter images. courstey Dr. G. D. Hager The thin lens Thin Lens Properties: 1. A ray entering parallel to optical axis goes through the focal point. 2. A ray emerging from focal point is parallel to optical axis 3. A ray through the optical center is unaltered 1 1 1 z' z f courstey Dr. G. D. Hager The thin lens 1 1 1 z' z f Note that, if the image plane is very small and/or z >> z’, then z’ is approximately equal to f courstey Dr. G. D. Hager Lens Realities Real lenses have a finite depth of field, and usually suffer from a variety of defects Spherical Aberration vignetting courstey Dr. G. D. Hager The equation of projection • Equating z’ and f – We have, by similar triangles, that (x, y, z) -> (-f x/z, -f y/z, -f) – Ignore the third coordinate, and flip the image around to get: x y (x, y, z) ( f , f ) z z courstey Dr. G. D. Hager Distant objects are smaller courstey Dr. G. D. Hager Parallel lines meet common to draw film plane in front of the focal point A Good Exercise: Show this is the case! courstey Dr. G. D. Hager Orthographic projection Suppose I let f go to infinity; then ux v y courstey Dr. G. D. Hager The model for orthographic projection X U 1 0 0 0 Y V 0 1 0 0 Z W 0 0 0 1 T courstey Dr. G. D. Hager Weak perspective • Issue – perspective effects, but not over the scale of individual objects – collect points into a group at about the same depth, then divide each point by the depth of its group – Adv: easy – Disadv: wrong u sx v sy s f /Z* courstey Dr. G. D. Hager The model for weak perspective projection X 0 U 1 0 0 Y 0 V 0 1 0 Z W 0 0 0 Z * / f T courstey Dr. G. D. Hager Model for perspective projection U 1 0 V 0 1 W 0 0 0 0 1 f X 0 Y 0 Z 0 T courstey Dr. G. D. Hager Intrinsic Parameters Intrinsic Parameters describe the conversion from unit focal length metric to pixel coordinates (and the reverse) x 1 / sx y 0 w 0 pix 0 1/ sy 0 ox x o y y K int p 1 w mm It is common to combine scale and focal length together as the are both scaling factors; note projection is unitless in this case! courstey Dr. G. D. Hager Image formation - Recap pixel coordinate system If we consider unit focal length x1 image coordinate system Scaling factor = depth of the point X camera coordinate system (R,T) world coordinate system Taken from MASKS (invitation to 3D vision) Camera parameters • Summary: – – – – points expressed in external frame points are converted to canonical camera coordinates points are projected points are converted to pixel units X U Transforma tion Transforma tion Transforma tion Y V representi ng representi ng representi ng W intrinsic parameters projection model extrinsic parameters Z T point in pixel coords. point in metric image coords. point in cam. coords. point in world coords. courstey Dr. G. D. Hager Camera Calibration The problem: Compute the camera intrinsic and extrinsic parameters using only observed camera data. Calibration with a Rig Use the fact that both 3-D and 2-D coordinates of feature points on a pre-fabricated object (e.g., a cube) are known. Calibration with Multiple Plane Images Actually used in practice these days Calibration Continued…