| 1 |
Camera Models |
| 2 |
============= |
| 3 |
|
| 4 |
COLMAP implements different camera models of varying complexity. If no intrinsic |
| 5 |
parameters are known a priori, it is generally best to use the simplest camera |
| 6 |
model that is complex enough to model the distortion effects: |
| 7 |
|
| 8 |
- ``SIMPLE_PINHOLE``, ``PINHOLE``: Use these camera models, if your images are |
| 9 |
undistorted a priori. These use one and two focal length parameters, |
| 10 |
respectively. Note that even in the case of undistorted images, COLMAP could |
| 11 |
try to improve the intrinsics with a more complex camera model. |
| 12 |
- ``SIMPLE_RADIAL``, ``RADIAL``: This should be the camera model of choice, if the |
| 13 |
intrinsics are unknown and every image has a different camera calibration, |
| 14 |
e.g., in the case of Internet photos. Both models are simplified versions of |
| 15 |
the ``OPENCV`` model only modeling radial distortion effects with one and two |
| 16 |
parameters, respectively. |
| 17 |
- ``OPENCV``, ``FULL_OPENCV``: Use these camera models, if you know the calibration |
| 18 |
parameters a priori. You can also try to let COLMAP estimate the parameters, |
| 19 |
if you share the intrinsics for multiple images. Note that the automatic |
| 20 |
estimation of parameters will most likely fail, if every image has a separate |
| 21 |
set of intrinsic parameters. |
| 22 |
- ``SIMPLE_RADIAL_FISHEYE``, ``RADIAL_FISHEYE``, ``OPENCV_FISHEYE``, ``FOV``, |
| 23 |
``THIN_PRISM_FISHEYE``, ``RAD_TAN_THIN_PRISM_FISHEYE``: Use these camera models |
| 24 |
for fisheye lenses and note that all other models are not really capable of |
| 25 |
modeling the distortion effects of fisheye lenses. The ``FOV`` model is used by |
| 26 |
Google Project Tango (make sure to not initialize ``omega`` to zero). |
| 27 |
- ``SIMPLE_FISHEYE``, ``FISHEYE``: Use these camera models for fisheye |
| 28 |
lenses with equidistant projection where distortion can be ignored |
| 29 |
or has been pre-corrected. These models use the equidistant projection |
| 30 |
(theta = atan(r)) without any distortion parameters. ``SIMPLE_FISHEYE`` |
| 31 |
has a single focal length (f), while ``FISHEYE`` has two (fx, fy). |
| 32 |
- ``SIMPLE_DIVISION``, ``DIVISION``: Use these camera models, if you know the |
| 33 |
calibration parameters a priori. Similar to ``SIMPLE_RADIAL`` and ``RADIAL`` |
| 34 |
models, they can model simple radial distortion effects. The two models |
| 35 |
have first-order local equivalence for small distortions. |
| 36 |
- ``EUCM``: Use this camera model for wide-angle fisheye cameras and catadioptric |
| 37 |
systems. It represents radial distortion using two |
| 38 |
parameters in addition to the standard pinhole parameters. |
| 39 |
|
| 40 |
You can inspect the estimated intrinsic parameters by double-clicking specific |
| 41 |
images in the model viewer or by exporting the model and opening the |
| 42 |
``cameras.txt`` file. |
| 43 |
|
| 44 |
Projection |
| 45 |
---------- |
| 46 |
|
| 47 |
All perspective camera models map a 3D point in the camera coordinate system to |
| 48 |
a 2D pixel coordinate in three steps: perspective division, distortion, and the |
| 49 |
intrinsic transform (focal length and principal point). COLMAP uses a |
| 50 |
corner-based pixel convention, in which the center of the top-left pixel is at |
| 51 |
``(0.5, 0.5)`` (see :doc:`database`). |
| 52 |
|
| 53 |
Taking ``SIMPLE_RADIAL`` (parameter list ``f, cx, cy, k``) as a worked example, a |
| 54 |
point :math:`(X, Y, Z)` in the camera frame, which looks down the positive |
| 55 |
:math:`Z` axis, is projected as follows: |
| 56 |
|
| 57 |
1. Perspective division onto the normalized image plane: |
| 58 |
|
| 59 |
.. math:: |
| 60 |
|
| 61 |
u = X / Z, \qquad v = Y / Z |
| 62 |
|
| 63 |
2. Radial distortion with :math:`r^2 = u^2 + v^2`: |
| 64 |
|
| 65 |
.. math:: |
| 66 |
|
| 67 |
u' = u \, (1 + k \, r^2), \qquad v' = v \, (1 + k \, r^2) |
| 68 |
|
| 69 |
3. Focal length and principal point, giving the pixel coordinate: |
| 70 |
|
| 71 |
.. math:: |
| 72 |
|
| 73 |
x = f \, u' + c_x, \qquad y = f \, v' + c_y |
| 74 |
|
| 75 |
The inverse mapping (pixel to normalized camera ray) subtracts the principal |
| 76 |
point, divides by the focal length, and then removes the distortion iteratively. |
| 77 |
|
| 78 |
All other perspective models share this three-step structure and differ only in |
| 79 |
the number of focal length parameters (a single shared ``f`` or separate ``fx``, |
| 80 |
``fy``) and in the distortion function, e.g. ``RADIAL`` adds a second radial term |
| 81 |
``k2`` and ``OPENCV`` adds tangential terms ``p1, p2``. The fisheye models |
| 82 |
instead replace the perspective division with an equidistant projection. The |
| 83 |
exact parameter list of every model is given by its ``params_info`` string and |
| 84 |
defined in the camera models header: |
| 85 |
https://github.com/colmap/colmap/blob/main/src/colmap/sensor/models.h |
| 86 |
|
| 87 |
Configuration |
| 88 |
------------- |
| 89 |
|
| 90 |
To achieve optimal reconstruction results, you might have to try different |
| 91 |
camera models for your problem. Generally, when the reconstruction fails and the |
| 92 |
estimated focal length values / distortion coefficients are grossly wrong, it is |
| 93 |
a sign of using a too complex camera model. Contrary, if COLMAP uses many |
| 94 |
iterative local and global bundle adjustments, it is a sign of using a too |
| 95 |
simple camera model that is not able to fully model the distortion effects. |
| 96 |
|
| 97 |
You can also share intrinsics between multiple |
| 98 |
images to obtain more reliable results |
| 99 |
(see :ref:`Share intrinsic camera parameters <faq-share-intrinsics>`) or you can |
| 100 |
fix the intrinsic parameters during the reconstruction |
| 101 |
(see :ref:`Fix intrinsic camera parameters <faq-fix-intrinsics>`). |