Revision 8f4fa3ac74d3837fbc1a5d2ea6af8d1982057e37 (click the page title to view the current version)
Changes from 8f4fa3ac74d3837fbc1a5d2ea6af8d1982057e37 to facb125da2ee5bb18397300aa8f61827d11b8d0d
---
title: Camera Mathematics
categories: session
categories: lecture
---
# Key Concepts
- calibration
- perspective
# Briefing
## Image Projection
### World frame and camera frame
$$\mathbf{X} = R\mathbf{X}_0 + T\in\mathbb{R}^3$$
### Projection
$$ 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.
### 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}
$$
# Exercises
# Debrief