






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Consider a point light emitted from the top of the Eiffel tower as shown in Figure 1.1. The light is located at located at X c = (Xc, Yc, Zc)T^ where the coordinate system is aligned with the camera optical axis, i.e., the origin is at the camera center (pinhole), and Z axis is the camera look-out vector (perpendicular to the CCD sensor plane). While the light travels over all directions, a particular light passes through the pinhole of the camera and is projected onto the camera’s CCD plane. The CCD plane is centered at Zscreen = − fm where fm is focal length of the camera, e.g., iPhone 7 camera has 29mm focal length. With the projected point in the CCD plane, it forms two similar triangles:
tan θ x = Xc Zc
uccd fm
where θ x is the vertical angle (opposite angles made by two intersecting lines), and uccd is the x-coordinate of the projected point. Similarly, the y-coordinate can be written as:
tan θ y = Yc Zc = vccd fm
This is called perspective projection where a 3D point (Xc, Yc, Zc)T^ ∈ R^3 is
X (^) c Yc Z (^) c ( , , )T
: Focal length in meter
Pinhole
Projection plane ( u (^) ccd (^) , v ccd )T
f m
CCD plane
θ x
f m
( u (^) ccd (^) , v (^) ccd )T
Z screen (^) = − f m
Figure 1.1: A 3D point (Xc, Yc, Zc )T^ is projected onto the CCD plane at fm to form (uccd, vccd)T. One dimension (depth) is lost during this metric projection. To simplify the representation, we will use the mirror image of the CCD plane.
mapped to a 2D point (uccd, vccd)T^ ∈ R^2 using the following equations: [ uccd vccd
= − fm
tan θ x tan θ y
fm Zc
Xc Yc
Note 1.1. This projection produces an upside-down image due to the negative sign.
Note 1.2. There is one dimensional information loss (R^3 → R^2 ) due to the projection.
Figure 1.2: Camera obscura sketched by Leonardo da Vinci in Codex Atlanticus (1515), preserved in Biblioteca Ambrosiana, Milan (Italy).
This projection is equivalent to the projection onto the virtual screen in front of the pinhole at fm, which can drop the negative sign and correct the upside-down image: [ uccd vccd
fm Zc
Xc Yc
This representation is similar to da Vinci’s camera obscura sketch as shown in Figure 1.2 illustrating a perspective painting tool.
Example 1.1 (Subject size). Consider a person (1.8m height) at 4m away from a photographer using an iPhone 7. How big does this person appear in the image? Answer iPhone 7 has 3.99mm focal length^1 and 1/3 inch sensor size 1 28mm with 7.21 crop factor in 35mm (4.8mm×3.6mm). The person will occupy the half of the image because: equivalent focal length.
vccd = 3.99mm × 1.8m 4m ≈ 1.8mm,
which is a half of the CCD sensor’s height (3.6mm).
Equation (1.4) is the projection of a 3D point onto the CCD plane in met- ric scale. As a result of the projection, the light intensity is recorded in a form of an image represented by pixels, i.e., the CCD contains an array of photo-receptors where each receptor corresponds to a pixel in the image. The projected location in the CCD plane is directly related with the pixel location in the image: the relative locations in the CCD sensor with respect to the sensor size and in the image with respect to the image size are the same:
uimg Wimg
uccd Wccd
vimg Himg
vccd Hccd
where (Wccd, Hccd) is width and height of the CCD sensor, e.g., (4.8mm×3.6mm) for iPhone 7, and (Wimg, Himg) is width and height of the image, e.g., (4k pix×3k pix). (uimg, vimg)T^ is the equivalent location of (uccd, vccd)T^ in the image as shown in Figure 1.2.
where u img = (uimg, vimg)T^ and X c = (Xc, Yc, Zc)T. K is called the camera’s intrinsic parameter that transforms X c in metric space to u img in pixel space. It includes focal length and principal point in pixel. Zc is the depth of the 3D point with respect to the camera, which is often unknown due to loss of dimension. We represent the unknown depth factor using λ :
λ
u img 1
= KX c (1.10)
where λ is an unknown scalar.
250 pix
670 pix
(a) Image
fm = 50 mm
Z boy
h boy
h eif
Z eif (b) Geometry
Figure 1.4: It is possible to predict the location of the boy (where am I?) with respect to the Eiffel Tower.
Example 1.2 (Where was I?). Consider an old picture in Figure 1.4(a) taken from a film camera with approximately 50mm focal length. The 4 years old boy appears 250 pixels in the image where the height of image is 1280 pixels while the Eiffel Tower appears 670 pixels. Where was the boy? Answer In an old day, 35mm film has been widely used. The distance from the photographer to the boy (average height of 4 year old male: hboy =102.3cm) is:
himgboy = fm
Himg Hccd
hboy Zboy
Zboy = 50mm × 1280pix 35mm × 1.023m 250pix = 7.48m.
800 m
Figure 1.5: We verify the distance prediction using Google Streetview, which is similar to Figure 1.4(a).
Similarly, the distance from the photographer to the Eiffel Tower (324m) is:
himgeif = fm Himg Hccd
heif Zeif Zeif = 50mm × 1280pix 35mm
324m 670pix = 884.2m.
The distance from the boy to the Eiffel Tower is approximately 877m. Fig- ure 1.5 shows a Google Streetview image taken a similar location, which is approximately 800m away from the Eiffel Tower.
The focal length of a camera defines the field of view and zoom factor. Larger focal length makes the pixel coordinate larger in Equation (1.7), resulting in zooming in and reducing field of view as shown in Figure 1.8 and 1.3. This also makes an object appeared relatively flat because the camera focuses on large distant objects (Z 0 ) where the object’s thickness ∆d is relatively smaller as shown in Figure 1.6:
Z ∆ d
Figure 1.6: For large focal length, objects in the image are seen relatively flat.
uimg = fx
Z + ∆d +^ px^ ≈^ fx
Xc Z +^ px^ (1.11)
if Z ∆d. Conversely, smaller focal length produces wide field of view and generates greater perspective sensation.
Figure 1.7: An image with larger focal length produces zoom-in effect.
Figure 1.8: The larger focal length, the smaller field of view.
As noted earlier, the principal point (px, py)T^ in the intrinsic parameter is often aligned with the center of image. However, the mechanical mis- alignment can occur due to lens and sensor geometric configuration where the center of lens is shifted with a few pixels caused by errors in camera manufacturing. Also physical force applied to modern cameras mounted on cellphone, laptop, and tablet can result in mis-alignment. In some case where the sensor and lens are not parallel, a skewed image
Pinhole
Projection plane
Figure 1.10: Dolly zoom geometry.
h img^ =400pix A
h^ img^ =120pix B
Figure 1.11: Image at ZA.
Solution From Equation (1.13), the foreground object A appears constant:
himg A = f hA ZA = 2 f hA ZA + ∆Z
Also, background object B satisfies the following:
himg B = f hA ZA + d
ZA and f are unknown. From Equation (1.15) and (1.16),
ZA = d himg A himg B
hB hA −^1
= 0.5m,
and therefore, ∆Z =0.5m. f can be computed by back-substitution, which is 50pix. Finally, the background object B will appear:
̂ himg B = 2 f hB ZA + ∆Z + d = 100pix.
The coordinate of the 3D world point, X c in Equation (1.10) aligns with the first person camera. If the camera moves, the point representation also changes as the camera coordinate system moves although it is stationary point. Alternatively, it can be represented by the fixed world coordinate, X w with an Euclidean transform to the camera:
X c = RX w + t , (1.17)
where R ∈ SO( 3 ) is a rotation matrix which is orthogonal, i.e., R T R = RR T^ = I 3 and det( R ) = 1 , that transforms the third person world coordi- nate to first person camera coordinate. t ∈ R^3 is a translation vector which is the world origin seen from the camera coordinate system at the camera origin, i.e., t is represented in the camera coordinate.
Equivalently, the Euclidean transformation can be written as: X c = R ( X w − C ) , (1.18) where C is the camera origin seen from the world coordinate where C = − R T t. Note that Equation (1.17) translates after the rotation while Equa- tion (1.18) translates before the rotation. By combining Equation (1.10) and (1.17),
λ
u img 1
R t
] [ X w 1
] [ X w 1
X w 1
where P ∈ R^3 ×^4 is called camera projection matrix that maps a 3D world coordinate to the first person image (metric space to pixel space). It includes intrinsic parameter (focal length and principal point) and extrinsic parameter (rotation and translation). MATLAB 1.1 (Orbiting camera). Draw 3D polygons such as cubics similar to Figure 1.12 and animate the sequence of images while the camera orbiting around the polygon.
r
r
Figure 1.12: Camera motion orbiting around a cubic.
Answer The camera motion can be written as:
r cos θ r sin θ 0
− sin θ cos θ 0 0 0 − 1 − cos θ − sin θ 0
RotateCamera.m 1 K = [200 0 100; 2 0 200 100; 3 0 0 1]; 4 r = 5; 5 theta = 0:0.02:2pi; 6 for i = 1 : length(theta) 7 C = [rcos(theta(i)); r*sin(theta(i)); 0]; 8 R = [-cos(theta(i)) -sin(theta(i)) 0; 9 0 0 -1; 10 -sin(theta(i)) cos(theta(i)) 0]; 11 P = K * R (^) * [eye(3) -C]; 12 proj = []; 13 for j = 1 : size(sqaure_point,1) 14 u = P * [sqaure_point(j,:)’;1]; 15 proj(j,:) = u’/u(3); 16 end 17 end
Similarly, u Y and u Z can be represented by p 2 and p 3 , respectively, as shown in Figure 1.13. p Y
l X
p X p Z
l Y
Figure 1.14: The rows of the camera projection matrix represents the 3 planes of camera axes.
Second, the rows of the projection matrix, P =
p T X p T Y p T Z
indicates the planes defined by the camera axes, i.e., YZ, ZX, and XY planes. Among all world 3D points, X w, particular points project onto the line l X that aligns with the X axis of the image:
λ
u 0 1
− p X − − p Y − − p Z −
X w 1
which indicates p Y X w = 0 , or p Y 1 Xw + p Y 2 Yw + p Y 3 Zw + p Y 4 = 0 where p Y = ( p Y 1 , p Y 2 , p Y 3 , p Y 4 ). Such points are the points on the plane that passes the camera optical center and l X in 3D. This plane is represented by p Y, which is perpendicular to the camera’s Y axis (the plane spanned by the camera’s X and Z axes). Similarly, p X represents the plane spanned by the camera’s Y and Z axes as shown in Figure 1.14. Notably, p Z represents the set of points in the line at infinity (see Sec- tion ??), i.e.,
λ
u Z 0
− p X − − p Y − − p Z −
X w 1
These points lie in the plane parallel to the projection plane at the camera optical center. Therefore, p Z represents the plane spanned by X and Y axes of the camera.
The dolly zoom effect in Section 1.4 can induce strong depth sensation as controlling the focal length. For instance, in Figure 1.15, the depth sensation, or perspectiveness in the left image is less stronger than the right image. The left image was taken by farther away from the camera with larger focal length. Weak perspectiveness Strong perspectiveness
Figure 1.15: The rows of the camera projection matrix represents the 3 planes of camera axes.
Two distances play a role: (1) distance, Z, between an object and camera; (2) distance, d, between objects. If d/Z ≈ 0 where the camera is far from the objects, the perspectiveness becomes less powerful, i.e., satellite image. This creates a special instance of the projective camera called affine camera. Consider an object X moves away from the camera along the camera’s optical axis r T z , i.e., X affine = X + μ r z. While moving away, the camera focal length is adjusted as the dolly zoom effect such that it maintains the size of the object faffine = f (d + μ )/d from Equation (1.14) where d and f are the distance of X and focal length before moving, respectively.
The affine projection of X can be written as:
uaffine = (^) μ lim→∞ f ( μ + d)( r x X + tx ) + px d( r z X + tz + μ ) = f d ( r x X + tx ) , (1.30)
where the subscript xy indicates the first two rows of matrix, i.e., R xy = [ r T x r T y
. Likewise, the Y coordinate of the affine projection can be expressed, which results in:
u affine =
f /d 0 0 f /d
− r x − tx − r y− ty
= K affine
R xy X + t xy
Note that this projection is linear, i.e., no scalar on LHS in Equation (1.32), which simplifies the projective geometry yet a good approximation of objects at far distance.
Figure 1.16: Orthographic camera
When the image coordinate is normalized by the intrinsic parameter, i.e., K −affine^1 u affine, it also produces a special instance of the affine camera called orthographic camera:
u orth =
− r x − tx − r y− ty
R xy X + t xy
Note that the orthographic projection maps from metric to metric space where there is no notion of pixel space as shown in Figure 1.16.