Algorithm Search⌘K

Modelcore

Affine camera model

Also called weak perspective camera, orthographic camera, paraperspective camera.

A camera whose last row of P is (0, 0, 0, 1), so parallel lines stay parallel; a good model when the depth of the scene is small next to its distance.

An affine camera is a camera projection matrix whose last row is (0,0,0,1)(0, 0, 0, 1). It maps a 3D point to the image by an affine map, a linear map plus a shift, with no division by the depth. So parallel lines in space stay parallel in the image, and the ratio of lengths along a line is kept. A real lens does not do this, but a pinhole camera that sees a shallow object from far away comes very close, because then all points have about the same depth. The affine camera is the limit of a finite camera whose center moves to infinity, and it is the model behind Tomasi-Kanade factorization. The graphics page pinhole camera model mentions parallel projection as the limit of a far camera; its view direction is −w-w, and here it is +Z+Z.

The machine

The map. An affine camera is a 3×43 \times 4 matrix

PA=(m11m12m13t1m21m22m23t20001)=(M2t0T1),P_A = \begin{pmatrix} m_{11} & m_{12} & m_{13} & t_1 \\ m_{21} & m_{22} & m_{23} & t_2 \\ 0 & 0 & 0 & 1 \end{pmatrix} = \begin{pmatrix} M_2 & \mathbf{t} \\ 0^{\mathsf T} & 1 \end{pmatrix},

where the 2×32 \times 3 block M2M_2 has rank 2. The image of the world point XX is

x=M2X+t.x = M_2 X + \mathbf{t}.

In homogeneous coordinates, PA(X,1)T=(M2X+t,1)P_A (X, 1)^{\mathsf T} = (M_2 X + \mathbf{t}, 1) already has last entry 1, so there is no perspective division. The model has 8 degrees of freedom: the 8 free entries of PAP_A.

Domain. Every point of space has an image, with no front and no back: the model has no depth sign and no field of view. The image of a point at infinity (d,0)(d, 0) is (M2d,0)(M_2 d, 0), again at infinity. That is the reason why parallel lines stay parallel.

The center and the inverse. The left 3×33 \times 3 block of PAP_A is singular, so the center is the point at infinity (d,0)(d, 0) with M2d=0M_2 d = 0. All rays are parallel to dd: this is a parallel projection. The map has no inverse. A pixel xx is the image of the whole line of points X0+λdX_0 + \lambda d with M2X0=x−tM_2 X_0 = x - \mathbf{t}.

The hierarchy (HZ section 6.3). With RR a rotation with rows r1T,r2T,r3Tr_1^{\mathsf T}, r_2^{\mathsf T}, r_3^{\mathsf T}, the affine cameras used in practice are, from the most restricted:

  • Orthographic projection, 5 degrees of freedom: M2=(r1Tr2T)M_2 = \begin{pmatrix} r_1^{\mathsf T} \\ r_2^{\mathsf T} \end{pmatrix}. The point is dropped along the optical axis r3r_3 onto the image.
  • Scaled orthographic projection, 6 degrees of freedom: M2=k(r1Tr2T)M_2 = k \begin{pmatrix} r_1^{\mathsf T} \\ r_2^{\mathsf T} \end{pmatrix}, one scale kk.
  • Weak perspective projection, 7 degrees of freedom: M2=diag⁡(αx,αy)(r1Tr2T)M_2 = \operatorname{diag}(\alpha_x, \alpha_y) \begin{pmatrix} r_1^{\mathsf T} \\ r_2^{\mathsf T} \end{pmatrix}, two scales.
  • The general affine camera, 8 degrees of freedom: M2=(αxs0αy)(r1Tr2T)M_2 = \begin{pmatrix} \alpha_x & s \\ 0 & \alpha_y \end{pmatrix} \begin{pmatrix} r_1^{\mathsf T} \\ r_2^{\mathsf T} \end{pmatrix}, which is every M2M_2 of rank 2.

Paraperspective projection (Aloimonos, 1990) is also an affine camera, but its parameters depend on a reference point X0X_0 of the scene, usually the centroid, at depth Z0Z_0. It first moves each point onto the plane Z=Z0Z = Z_0 along the direction from the camera center to X0X_0, and then projects that plane by the true camera. In camera coordinates with focal length ff, u−cx=(f/Z0) (X−(X0/Z0)(Z−Z0))u - c_x = (f / Z_0)\,(X - (X_0 / Z_0)(Z - Z_0)), and the same for vv. It keeps the first order effect of the position of the object off the optical axis.

As an approximation. Take a pinhole camera with focal length ff in pixels and a point at depth Z0+ΔZ_0 + \Delta in the camera frame. The pinhole gives u−cx=fX/(Z0+Δ)u - c_x = f X / (Z_0 + \Delta), and weak perspective projection, which uses the same depth Z0Z_0 for all points, gives fX/Z0f X / Z_0. The error is

fX(1Z0−1Z0+Δ)=fXΔZ0(Z0+Δ),f X \left(\frac{1}{Z_0} - \frac{1}{Z_0 + \Delta}\right) = \frac{f X \Delta}{Z_0 (Z_0 + \Delta)},

which is small when the depth relief Δ\Delta is small next to Z0Z_0 and the point is close to the optical axis (XX small). This is the content of the error analysis in HZ section 6.3.

What it counts

The model predicts the image position x=M2X+tx = M_2 X + \mathbf{t} of each point, in pixels. A fit of the model to matches Xi↔xiX_i \leftrightarrow x_i minimizes the reprojection error ∑i∥xi−M2Xi−t∥2\sum_i \|x_i - M_2 X_i - \mathbf{t}\|^2. Because the image coordinates are linear in the 8 parameters, this geometric error is the same as the algebraic error, so a single least squares problem gives the maximum likelihood camera under isotropic Gaussian noise on the image points. Each match gives 2 equations, so 4 matches with points that are not coplanar fix the 8 parameters. A finite camera needs 6 matches and a nonlinear fit for the same cost function.

Relation to other models

  • Finite camera. Let a finite camera with P=K[R∣t]P = K [R \mid t] move back along its optical axis by a distance DD and zoom in by the factor (t3+D)/t3(t_3 + D) / t_3, so that the image of the object keeps its size. As D→∞D \to \infty, PP (after a rescale) tends to an affine camera (HZ section 6.3). So the affine camera is the limit of a camera at infinity, which is why HZ calls the class cameras at infinity.
  • Graphics. Parallel projections in graphics, for example the orthographic view of a CAD drawing, are orthographic projection with a viewport transform after it.
  • Homography. Restricted to a world plane, an affine camera is an affine map of that plane, a homography with last row (0,0,1)(0, 0, 1), with 6 degrees of freedom instead of 8.

Known results in the model

  • Parallelism and centroids (theorem). An affine camera maps parallel lines to parallel lines, and the centroid of a set of points to the centroid of their images. Proof: the map X↦M2X+tX \mapsto M_2 X + \mathbf{t} is affine, so it keeps the means of points and sends a direction dd to the direction M2dM_2 d.
  • Linear estimation (theorem). From n≥4n \ge 4 matches with points not all on one plane, the affine camera of least reprojection error is the solution of a linear least squares problem in its 8 entries, as shown above. No iteration is needed.
  • Rank 3 factorization (theorem; Tomasi and Kanade, 1992). Take NN affine views of nn points, subtract from the image points of each view their centroid, and stack the results into a 2N×n2N \times n matrix. Without noise, this matrix equals the product of the stacked 2N×32N \times 3 matrix of the M2M_2 blocks and the 3×n3 \times n matrix of centered points, so its rank is at most 3. A truncated SVD then gives motion and shape up to an affine transformation of space; Tomasi and Kanade fix it to a similarity with the constraints of orthographic projection.
  • Depth reversal (theorem). Under orthographic projection, a scene and its mirror image in a plane parallel to the image give the same image. More views do not remove this: with S=diag⁡(1,1,−1)S = \operatorname{diag}(1, 1, -1), the mirrored points SXS X and the rotations SRSS R S give exactly the same images as XX and RR in every view, because the first two rows of SRSS R S applied to SXS X give the first two rows of RR applied to XX.
  • Size of the error (a worked bound). At f=800f = 800, a point at X=1X = 1 off the axis, with Z0=10Z_0 = 10 and Δ=0.5\Delta = 0.5, the weak perspective error is 800⋅1⋅0.5/(10⋅10.5)≈3.81800 \cdot 1 \cdot 0.5 / (10 \cdot 10.5) \approx 3.81 pixels: 76.1976.19 pixels from the principal point against 8080. For a point at X=2.5X = 2.5, Z=10.5Z = 10.5 with reference point X0=2X_0 = 2, Z0=10Z_0 = 10, the true value is 190.48190.48, weak perspective gives 200200 (error 9.529.52) and paraperspective projection gives 192.0192.0 (error 1.521.52). These numbers come from the formulas above and hold only for this example.

References

  1. Richard Hartley and Andrew Zisserman, Multiple View Geometry in Computer Vision, second edition, Cambridge University Press, 2004, Section 6.3, Cameras at infinity (affine cameras, the error of the affine approximation, and the hierarchy of orthographic, scaled orthographic, weak perspective and affine projection); Chapter 7 for the estimation of an affine camera
  2. Carlo Tomasi and Takeo Kanade, Shape and motion from image streams under orthography, a factorization method, International Journal of Computer Vision 9(2), 1992, 137-154, the rank 3 property of the centered measurement matrix under orthographic projection, and the factorization that follows from it
  3. Peter Sturm, Srikumar Ramalingam, Jean-Philippe Tardif, Simone Gasparini and Joao Barreto, Camera models and fundamental concepts used in geometric computer vision, Foundations and Trends in Computer Graphics and Vision 6(1-2), 2011, 1-183, the part on affine and other parallel projection models

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/XAA2FV/text.yaml