Algorithm Search⌘K

Definitioncore

Camera projection matrix

Also called 3x4 camera matrix, finite projective camera.

The 3 by 4 matrix P = K[R | t] that maps a world point in homogeneous coordinates to its image point, with 11 degrees of freedom.

The camera projection matrix is the 3×43 \times 4 matrix PP that maps a point of 3D space, written in homogeneous coordinates as X=(X,Y,Z,1)T\mathbf{X} = (X, Y, Z, 1)^{\mathsf T}, to its image point x∼PX\mathbf{x} \sim P \mathbf{X}. For a pinhole camera P=K[R∣t]P = K [R \mid t], the product of the camera intrinsic matrix KK and the camera extrinsic parameters (R,t)(R, t). PP is known only up to scale, so it has 12−1=1112 - 1 = 11 degrees of freedom, which are exactly the 5 intrinsic and the 6 extrinsic ones. This page defines PP and lists what can be read from it. Getting PP from point matches is DLT resectioning, and getting KK, RR and tt back from PP is camera matrix decomposition. The graphics page pinhole camera model uses the same map with the view direction −w-w; this area looks along +Z+Z.

Definition

The pinhole camera. Let KK be an intrinsic matrix, RR a rotation and tt a vector, with the conventions of this area: Xc=RXw+tX_c = R X_w + t, the camera frame has XX right, YY down and ZZ forward, and the center of pixel (u,v)(u, v) is the point (u,v)(u, v). The camera matrix is

P=K[R∣t]=KR[I∣−C],C=−RTt,P = K [R \mid t] = K R [I \mid -C], \qquad C = -R^{\mathsf T} t,

and the pixel of the world point XwX_w is found by

(u′v′w′)=P(Xw1),(u,v)=(u′/w′,  v′/w′).\begin{pmatrix} u' \\ v' \\ w' \end{pmatrix} = P \begin{pmatrix} X_w \\ 1 \end{pmatrix}, \qquad (u, v) = (u' / w', \; v' / w').

For a point in front of the camera, w′w' is its depth ZZ in the camera frame, so the division needs w′≠0w' \ne 0.

General and finite cameras. A general projective camera is any real 3×43 \times 4 matrix of rank 3, up to a nonzero scale (HZ section 6.2). Write P=[M∣p4]P = [M \mid p_4] with MM the left 3×33 \times 3 block. If MM is nonsingular, PP is a finite camera, and then it factors as P=λK[R∣t]P = \lambda K [R \mid t] with KK upper triangular with a positive diagonal and K33=1K_{33} = 1, RR a rotation and λ≠0\lambda \ne 0; with these sign rules the factors are unique. If MM is singular, the center lies on the plane at infinity; the affine camera, whose last row is (0,0,0,1)(0, 0, 0, 1), is the main case.

Degrees of freedom. PP has 12 entries and one scale, so 11 degrees of freedom. A finite camera has the same count: 5 in KK, 3 in RR and 3 in tt. Each 2D to 3D match gives two equations, so 6 matches in general position fix PP (5.5 in the minimum).

What the matrix holds (HZ section 6.2). Let m3Tm_3^{\mathsf T} be the third row of MM and piTp^{i\mathsf T} the rows of PP.

  • Camera center. CC is the right null vector: P(C,1)T=0P (C, 1)^{\mathsf T} = 0. For a finite camera, C=−M−1p4C = -M^{-1} p_4. Every point on a ray through CC has the same image, and CC itself has none.
  • Columns. The first three columns p1,p2,p3p_1, p_2, p_3 are the images of the points at infinity in the directions of the world XX, YY and ZZ axes, that is, their vanishing points. The last column p4p_4 is the image of the world origin.
  • Rows. Each row is a plane of space. The third row p3p^3 is the principal plane: the plane through CC parallel to the image, whose points have w′=0w' = 0 and map to infinity. The rows p1p^1 and p2p^2 are the planes through CC that map to the image lines u=0u = 0 and v=0v = 0.
  • Principal axis and point. The vector det⁡(M) m3\det(M)\, m_3 points along the optical axis, to the front of the camera, and the principal point is Mm3M m_3 up to scale.
  • Depth. For X=(Xw,1)\mathbf{X} = (X_w, 1) and w′=p3TXw' = p^{3\mathsf T} \mathbf{X}, the depth of the point is sign⁡(det⁡M) w′/∥m3∥\operatorname{sign}(\det M)\, w' / \|m_3\|. It is positive for a point in front of the camera, whatever the scale of PP.
  • Back-projection. The pixel x\mathbf{x} is the image of all points C+λM−1xC + \lambda M^{-1} \mathbf{x}; the front half of this line is the ray that the pixel sees.
  • A plane. For the world plane Zw=0Z_w = 0, the map from (Xw,Yw,1)(X_w, Y_w, 1) to the image is the 3×33 \times 3 matrix K[r1  r2  t]K [r_1 \; r_2 \; t], a homography. Zhang's method is built on this fact.

Examples and non-examples

A camera five units back. Let KK have fx=fy=800f_x = f_y = 800, s=0s = 0 and principal point (320,240)(320, 240), and let R=IR = I and t=(0,0,5)t = (0, 0, 5). Then

P=(80003201600080024012000015).P = \begin{pmatrix} 800 & 0 & 320 & 1600 \\ 0 & 800 & 240 & 1200 \\ 0 & 0 & 1 & 5 \end{pmatrix}.
  • The world point (1,0.5,0)(1, 0.5, 0) gives P(1,0.5,0,1)T=(2400,1600,5)P (1, 0.5, 0, 1)^{\mathsf T} = (2400, 1600, 5), so its pixel is (480,320)(480, 320), and its depth is 5.
  • The null vector is (0,0,−5,1)(0, 0, -5, 1): P(0,0,−5,1)T=(−1600+1600,−1200+1200,−5+5)=0P (0, 0, -5, 1)^{\mathsf T} = (-1600 + 1600, -1200 + 1200, -5 + 5) = 0. So C=(0,0,−5)=−RTtC = (0, 0, -5) = -R^{\mathsf T} t.
  • The third column (320,240,1)(320, 240, 1) is the principal point: the world ZZ axis is the optical axis, and its vanishing point is where the axis meets the image. The first column (800,0,0)(800, 0, 0) is a point at infinity of the image, because the world XX axis is parallel to the image plane.
  • 2P2P and −P-P give the same pixels. With −P-P, w′=−5w' = -5 for the same point, but det⁡M\det M also changes sign, so the depth formula still gives +5+5.

Not every matrix is a camera.

  • A 3×43 \times 4 matrix of rank 2, for example one with a zero third row, is not a camera: it maps all of space into a line or to points at infinity, and its null space is a line, not a point.
  • A finite camera needs det⁡M≠0\det M \ne 0. The matrix (100001000001)\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} has rank 3, so it is a projective camera, but MM is singular: it is the orthographic projection (X,Y,Z)↦(X,Y)(X, Y, Z) \mapsto (X, Y), an affine camera with its center at infinity.
  • A 3×33 \times 3 homography is not a camera matrix. It maps one plane to the image, and it is what PP becomes on that plane.
  • The 4×44 \times 4 projection matrix of a graphics API is not PP. It keeps a fourth row for the depth buffer and maps to clip coordinates, before the viewport transform.

References

  1. Richard Hartley and Andrew Zisserman, Multiple View Geometry in Computer Vision, second edition, Cambridge University Press, 2004, Section 6.1, Finite cameras, and Section 6.2, The projective camera (the camera center as null vector, the column and row vectors, the principal plane, axis and point, the depth of points, back-projection)
  2. Richard Szeliski, Computer Vision, Algorithms and Applications, second edition, Springer, 2022, Chapter 2, Image formation (the 3 by 4 camera matrix)
  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 the perspective camera and its projection matrix

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/N0TBTV/text.yaml