Revision ab5eea059e742586224fddbb5bcdbc2fe5464143 (click the page title to view the current version)

Camera Mathematics

Changes from ab5eea059e742586224fddbb5bcdbc2fe5464143 to 7848a16fc0f48fd7f155297eb15468b17fd01144

---
title: Camera Mathematics
categories: session
---

# Key Concepts

- calibration
- perspective

# Briefing

## World frame and camera frame
## Image Projection

### World frame and camera frame

$$\mathbf{X} = R\mathbf{X}_0 + T\in\mathbb{R}^3$$

## Projection
### 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
### 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
### From meters to pixels

+ Same units for world frame and image frame, i.e. meter
+ Meaningless - images are measured in pixels

**TODO** complete

## Distortion

### 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