Pinhole Camera
Perspective Projection
- Generally:
- Points/straight lines/polygons project to polygons
- Degenerate cases:
- Straight lines passing through center of projection: projected as points
- Polygons lying on planes passing through center of projection: projected as straight lines
Projects 3D entities onto 2D surface by straight lines passing through a single point (center of projection).
Perspective Projection Equation
$$ \frac{x}{f} = \frac{X_c}{Z_c} \Rightarrow x = \frac{f X_c}{Z_c}\ \frac{y}{f} = \frac{Y_c}{Z_c} \Rightarrow y = \frac{f Y_c}{Z_c}\
$$
Circle
$$ X_c = (a \cos{\theta}, a \sin{\theta}, Z_0)\ x = (\frac{f a \cos{\theta}}{Z_0}, \frac{f a \sin{\theta}}{Z_0})
$$
Move along $$X_c$$ by $$X_0$$, also a circle:
$$ X_c = (a \cos{\theta} + X_0, a \sin{\theta}, Z_0)\ x = (\frac{f (a \cos{\theta} + X_0)}{Z_0}, \frac{f a \sin{\theta}}{Z_0}) = (\frac{f a \cos{\theta}}{Z_0} + \frac{f X_0}{Z_0}, \frac{f a \sin{\theta}}{Z_0})
$$
But circle does not always project to a circle.
Vanishing Point
Straight lines in space appear to vanish at a point in image. Does not depend on the position but on the orientation of the line.
Parallel lines share a common vanishing point. Each set of them will have a different vanishing point in the image, corresponding to the image of the point at infinity in the direction of the parallel lines.
Vanishing Line
Parallel planes in space meet at vanishing line in image.Think of them as an infinite number of parallel lines.
Perspective Constructions
Under perspective projection, ratios of lengths & areas are not preserved.
- Find out vanishing point by intersecting parallel lines
- Find out center i.e. intersection of the diagonals
- Connect vanishing point with center to find out center lines
- Do 2. & 3. for smaller squares
Vanishing Points
Equation of line:
$$ X_c = a + \lambda b = \begin{bmatrix} a_x & a_y & a_z \end{bmatrix}^T + \lambda \begin{bmatrix} b_x & b_y & b_z \end{bmatrix}^T
$$
where $$a$$ is position of line, $$b$$ is orientation, $$\lambda$$ is scale.
Image of line:
$$ x = f(\frac{a_x + \lambda b_x}{a_z + \lambda b_z}, \frac{a_y + \lambda b_y}{a_z + \lambda b_z})
$$
As $$\lambda \to \infty$$, $$x$$ converges to vanishing point $$v$$:
$$ v = \lim_{\lambda \to \infty} f(\frac{a_x + \lambda b_x}{a_z + \lambda b_z}, \frac{a_y + \lambda b_y}{a_z + \lambda b_z}) = f(\frac{b_x}{b_z}, \frac{b_y}{b_z})
$$
- When $$b_z = 0$$:
- Line parallel to image plane, vanishing point at infinity
- i.e. all vertical lines in the world have a vanishing point at infinity with the image plane being vertical
Full Camera Model
Describes the mapping from world coordinates to pixel coordinates.
Rigid Body Motion
Transformation that brings a point from the world coordinate system to the camera one.
Described by rotation matrix $$R$$ & translation vector $$T$$:
$$ X_c = RX + T
$$
$$ \begin{bmatrix} Xc \ Y_c \ Z_c \end{bmatrix} = \begin{bmatrix} r{00} & r{01} & r{02} \ r{10} & r{11} & r{12} \ r{20} & r{21} & r{22} \end{bmatrix}\begin{bmatrix} X \ Y \ Z \end{bmatrix} + \begin{bmatrix} T_x \ T_y \ T_z \end{bmatrix}
$$
Given the unit vectors $$V_x$$, $$V_y$$, $$V_z$$ of the axes of the camera coordinate system defined in the world coordinate system, or unit vectors $$U_x$$, $$U_y$$, $$U_z$$ of the axes of the world coordinate system defined in the camera coordinate system:
$$ \begin{bmatrix} X_c \ Y_c \ Z_c \end{bmatrix} = \begin{bmatrix} V_x^T \ V_y^T \ V_z^T \end{bmatrix}\begin{bmatrix} X \ Y \ Z \end{bmatrix}
$$
$$ \begin{bmatrix} X_c \ Y_c \ Z_c \end{bmatrix} = \begin{bmatrix} U_x & U_y & U_z \end{bmatrix}\begin{bmatrix} X \ Y \ Z \end{bmatrix}
$$
It follows that:
$$\begin{bmatrix} 1 \ 0 \ 0 \end{bmatrix} = \begin{bmatrix} V_x^T \ V_y^T \ V_z^T \end{bmatrix}\begin{bmatrix} V_x \end{bmatrix}$$$$\begin{bmatrix} 0 \ 1 \ 0 \end{bmatrix} = \begin{bmatrix} V_x^T \ V_y^T \ V_z^T \end{bmatrix}\begin{bmatrix} V_y \end{bmatrix}$$$$\begin{bmatrix} 0 \ 0 \ 1 \end{bmatrix} = \begin{bmatrix} V_x^T \ V_y^T \ V_z^T \end{bmatrix}\begin{bmatrix} V_z \end{bmatrix}$$
$$\begin{bmatrix} U_x \end{bmatrix} = \begin{bmatrix} U_x & U_y & U_z \end{bmatrix}\begin{bmatrix} 1 \ 0 \ 0 \end{bmatrix}$$$$\begin{bmatrix} U_y \end{bmatrix} = \begin{bmatrix} U_x & U_y & U_z \end{bmatrix}\begin{bmatrix} 0 \ 1 \ 0 \end{bmatrix}$$$$\begin{bmatrix} U_z \end{bmatrix} = \begin{bmatrix} U_x & U_y & U_z \end{bmatrix}\begin{bmatrix} 0 \ 0 \ 1 \end{bmatrix}$$
Coordinate System
RIght-handed coordinate system is adopted.
Perspective Projection
$$x = \frac{f X_c}{Z_c}$$$$y = \frac{f Y_c}{Z_c}$$
CCD Imaging
Transform a point from image plane coordinates $$(x, y)$$ into pixel coordinates $$w = (u, v)$$.
$$ u = k_u x + u_0\v = k_v y + v_0
$$
- $$(u_0, v_0)$$: principal point
- The point at which the optical axis pierces the image plane
- $$k_u$$, $$k_v$$: scale factors
- Number of pixels per unit length in each direction
Overall Mapping
World coordinates $$(X, Y, Z)$$ to pixel coordinate $$w = (u, v)$$:
$$ u = ku x + u_0 = k_u \frac{f X_c}{Z_c} + u_0 = \frac{k_u f(r{00}X + r{01}Y + r{02}Z + Tx)}{r{20}X + r{21}Y + r{22}Z + Tz} + u_0\ v = k_v y + v_0 = k_v \frac{f Y_c}{Z_c} + v_0 = \frac{k_v f(r{10}X + r{11}Y + r{12}Z + Ty)}{r{20}X + r{21}Y + r{22}Z + T_z} + v_0
$$