# Camera Models

## Pinhole Model

![](/files/cim7jmxwxFccZOE9tiBW)

Let point $$P = \[X, Y, Z]$$ located at the object in 3D space, point $$P' = \[X', Y', Z']$$ located on the imaging plane in 3D space, point $$P'' = \[u, v]$$ located on the image in pixel coordinates.&#x20;

Since most modern digital cameras will automatically flip the image to its upright position for us, we can move the imaging plane to the front side as well (same side as the object). Then we can make math easier (replace the -1 with 1) and have $$X' = f \frac{X}{Z}$$and $$Y' = f \frac{Y}{Z}$$ according to the similar triangle.&#x20;

The relation between three reference frames (O, O', and O'') is the following.&#x20;

$$
\begin{align\*} u &= \alpha X' + c\_x = f\_x \frac{X}{Z} + c\_x \ v &= \beta Y' + c\_y = f\_y \frac{Y}{Z} + c\_y \end{align\*}
$$

In matrix form, we can obtain the camera intrinsic matrix $$K$$.&#x20;

$$
\begin{equation\*}
Z\left(\begin{array}{l}
u \\
v \\
1
\end{array}\right)=\left(\begin{array}{ccc}
f\_{x} & 0 & c\_{x} \\
0 & f\_{y} & c\_{y} \\
0 & 0 & 1
\end{array}\right)\left(\begin{array}{l}
X \\
Y \\
Z
\end{array}\right) \stackrel{\text { def }}{=} \boldsymbol{K} \boldsymbol{P}
\end{equation\*}
$$

## MEI Model or UCM Model

* Paper: [Single View Point Omnidirectional Camera Calibration from Planar Grids](http://www.robots.ox.ac.uk/~cmei/articles/single_viewpoint_calib_mei_07.pdf)

## References

* [The Double Sphere Camera Model](https://ieeexplore.ieee.org/abstract/document/8491007), Daniel Cremers group, 3DV 2018
  * Very good discussions and summary of camera models; read this paper first!
* [OpenCV Documentation: Camera Calibration and 3D Reconstruction](https://docs.opencv.org/2.4.8/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html)
* <https://en.wikipedia.org/wiki/Pinhole_camera_model>
* 14 Lectures in Visual SLAM


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.hanzheteng.com/algorithm/cv/camera-models.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
