Vanishing points & horizon

Parallel lines in the world are generally not parallel in the image: they meet in a vanishing point. Parallel lines on the same plane meet on a vanishing line, and for the ground plane that line is the horizon. Turn the camera and follow the vanishing points, including those far outside the image.

3D world drag to orbit, scroll to zoom
Camera image zoomed out: the light rectangle is the image

Where parallel lines meet

Take a 3D line through the point X\mathbf{X} with direction d\mathbf{d}. Its points X+s d\mathbf{X} + s\,\mathbf{d} project to

w[uv1]=K(R (X+s d)+t)=K(R X+t)+s KR dw \begin{bmatrix} u \\ v \\ 1 \end{bmatrix} = K \left( R\,(\mathbf{X} + s\,\mathbf{d}) + t \right) = K (R\,\mathbf{X} + t) + s\, K R\, \mathbf{d}

As the point moves away (s→∞s \to \infty), the second term dominates, and the image point approaches the vanishing point

v=KR d\mathbf{v} = K R\, \mathbf{d}

Neither X\mathbf{X} nor tt appears in it, so all lines with the same direction share the same vanishing point, and moving the camera without turning it does not move it. In the 3D view, the dashed ray from the camera center CC parallel to the lines hits the image plane exactly at v\mathbf{v}: the vanishing point is the image of the point at infinity in direction d\mathbf{d}. As in homogeneous coordinates, it can be computed as the intersection l1×l2l_1 \times l_2 of two image lines li=pi×qil_i = p_i \times q_i.

If d\mathbf{d} is parallel to the image plane, the third coordinate of KR dK R\,\mathbf{d} is w=0w = 0. Then the vanishing point is itself at infinity, and the image lines stay parallel. This is why vertical walls stay vertical in a photo taken with a level camera.

Vanishing lines and the horizon

All directions within a plane have their vanishing points on one line, the vanishing line of the plane (and of all planes parallel to it). It passes through any two of these vanishing points. For the ground plane, spanned by XX and YY, this is the horizon:

l=vX×vY,v⋅l=0 for every horizontal directionl = \mathbf{v}_X \times \mathbf{v}_Y, \qquad \mathbf{v} \cdot l = 0 \text{ for every horizontal direction}

The horizon is the image of the plane through the camera center parallel to the ground, so everything at the height of the camera lies on it. The ramp in the scene is tilted: its edges vanish above the horizon, on the vanishing line of the ramp's own surface (dashed purple).

One-, two- and three-point perspective

Conventions. The world frame is right-handed with ZZ up; the camera frame has xx right, yy down and zz forward. The pose is set with yaw, pitch and roll as in the pinhole camera demo, with the camera at height hh above the ground.

Try this