Revision facb125da2ee5bb18397300aa8f61827d11b8d0d (click the page title to view the current version)
Changes from facb125da2ee5bb18397300aa8f61827d11b8d0d to 4a32bd57ac5672ea7fe7526a9a079adc5c43b7a1
---
title: Camera Mathematics
categories: lecture
---
# Key Concepts
- calibration
- perspective
# Briefing
# Lectore Notes
## Image Projection
### World frame and camera frame
$$\mathbf{X} = R\mathbf{X}_0 + T\in\mathbb{R}^3$$
+ Change of basis
$$\mathbf{X} = R\mathbf{X}_0 + T \in\mathbb{R}^3 $$
+ or with homogeneous co-ordinates
$$\mathbf{X} = \begin{bmatrix} R & T \\ 0 & 1 \end{bmatrix}\cdot \mathbf{X}_0$$
### Projection
+ Recall the ideal perspective
$$\mathbf{x} = \begin{bmatrix}x\\y\end{bmatrix}
= \frac fZ\begin{bmatrix}x\\y\end{bmatrix}$$
+ In homogeneous co-ordinates we have
$$ Z \begin{bmatrix}x\\y\\1\end{bmatrix} =
\begin{bmatrix}f 0 0 0 \\0 f 0 0 \\0 0 1 0\end{bmatrix} \cdot
\begin{bmatrix}X\\Y\\Z\\1\end{bmatrix}$$
Note that $Z$ is typically unknown.
We write $\lambda (=Z)$ for this unknown constant.
+ $Z$ is typically unknown.
+ We write $\lambda (=Z)$ for this unknown constant.
$$ \lambda \begin{bmatrix}x\\y\\1\end{bmatrix} =
\begin{bmatrix}f 0 0 0 \\0 f 0 0 \\0 0 1 0\end{bmatrix} \cdot
\begin{bmatrix}X\\Y\\Z\\1\end{bmatrix}$$
### Ideal Camera Projection
$$ \lambda \begin{bmatrix}x\\y\\1\end{bmatrix} =
\begin{bmatrix}f 0 0 \\0 f 0 \\0 0 1 \end{bmatrix} \cdot
\begin{bmatrix}1 0 0 0 \\0 1 0 0 \\0 0 1 0\end{bmatrix} \cdot
\begin{bmatrix}R T \\0 1\end{bmatrix} \cdot
\begin{bmatrix}X\\Y\\Z\\1\end{bmatrix}$$
$$ \lambda \textbf{x} = K_f\Pi_0\mathbf{X} = K_f\Pi_0g\mathbf{X}_0$$
### From meters to pixels
+ Same units for world frame and image frame, i.e. meter
+ Meaningless - images are measured in pixels
**TODO** complete
## Distortion
### Calibration
+ Camera Calibration is a transformation in the *ideal* model
+ In addition we need calibration to compensate for distortion
= imperfection in the camera
+ Two types
+ Radial Distortion - typical for wide angle lenses
+ Tangential Distortion - when image plane and lense are not parallel
### Radial Distortion
+ Artifact of wide angle lenses (wide field of view).
+ Simplest effective model:
$$
\begin{align}
x &= x_d(1 + a_1r^2 + a_2r^4) \\
y &= y_d(1 + a_1r^2 + a_2r^4) \\
r &= x_d^2+y_d^2
\end{align}
$$
+ $(x,y)$ are the true co-ordinate of some point
+ $(x_d,y_d)$ are the co-ordinates in the distorted image
+ This is easy to automate, so we can disregard distortion for analysis
+ OpenCV uses at sixth order model
$$
\begin{align}
x_d &= x(1 + a_1r^2 + a_2r^4 + a_3r^6) \\
y_d &= y(1 + a_1r^2 + a_2r^4 + a_3r^6)
\end{align}
$$
## Tangential Distortion
Not discussed in the text book
+ Occurs when the lens and image plane are not parallel
$$
\begin{align}
x_d &= x+ [2p_1xy+p_2(r^2+2x^2)]
y_d &= y+[p_1(r^2+2y^2)+2p_2xy]
\end{align}
$$