|
| 1 | +--- |
| 2 | +sidebar_position: 1 |
| 3 | +title: Camera Intrinsic Models |
| 4 | +--- |
| 5 | +# Camera Intrinsic Models for Project Aria devices |
| 6 | + |
| 7 | +This page provides an overview of the intrinsic models used by RGB, Eye Tracking and Mono Scene (aka SLAM) cameras in Project Aria glasses. |
| 8 | + |
| 9 | +A camera intrinsic model maps between a 3D world point in the camera coordinate and its corresponding 2D pixel on the sensor. It supports mapping from the 3D point to the pixel (projection) and from the pixel to the ray connecting the point and the camera's optical center. |
| 10 | + |
| 11 | +Our projection models are based on polar coordinates of 3D world points. Given a 3D world point in the device frame $\mathbf{P}_d$, we first transform it to the camera's local frame |
| 12 | +$$ |
| 13 | +\mathbf{P}_c = (x, y, z) = T_\text{device}^\text{camera}\mathbf{P}_d |
| 14 | +$$ |
| 15 | + |
| 16 | +the corresponding polar coordinates $\Phi = (\theta, \varphi)$ that satisfies |
| 17 | +$$ |
| 18 | + x/z = \tan(\theta)\cos(\varphi), \quad |
| 19 | + y/z = \tan(\theta)\sin(\varphi). |
| 20 | +$$ |
| 21 | + |
| 22 | +We assume the camera has a single optical center and thus all points of the same polar coordinate maps to the same 2D pixel $\mathbf{p}$: |
| 23 | +$$ |
| 24 | + \mathbf{p} = f(\phi) |
| 25 | +$$ |
| 26 | +Here $f$ is the camera projection model. |
| 27 | + |
| 28 | +Inversely, we can unproject from a 2D camera pixel to the polar coordinate by |
| 29 | +$$ |
| 30 | + \Phi = f^{-1}(\mathbf{p}) |
| 31 | +$$ |
| 32 | + |
| 33 | +In Aria we support four types of project models, Linear, Spherical, KannalaBrandtK3, and FisheyeRadTanThinPrism. The linear camera model are standard textbook intrinsic models and good for image rectification. However, cameras on the Aria glasses all have fisheye lenses, and spherical camera model are much better approximations for these glasses. In order to calibrate the camera lenses at a high quality, we use two more sophisticated camera models to add modeling of radial and tangential distortions. |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +The next table shows which model is used for each type of Aria camera: |
| 41 | + |
| 42 | +| Camera Type | Intrinsics Model | |
| 43 | +|---------------------------|-------------------------| |
| 44 | +| Slam Camera | FisheyeRadTanThinPrism | |
| 45 | +| Rgb Camera | FisheyeRadTanThinPrism | |
| 46 | +| Eye-Tracking Camera | KannalaBrandtK3 | |
| 47 | + |
| 48 | +## The linear camera model |
| 49 | +The linear camera model (a.k.a pinhole model) is parametrized by 4 coefficients : f_x, f_y, c_x, c_y. |
| 50 | + |
| 51 | +$(f_x, f_y)$ are the focal lengths, and $c_x, c_y$ are the coordinate of the projection of the optical axis. |
| 52 | +It maps from world point $(x,y,z)$ to 2D camera pixel $\mathbf{p}=(u, v)$ with the following formulae. |
| 53 | +$$ |
| 54 | + u = f_x x/z + c_x \\ |
| 55 | + v = f_y y/z + c_y |
| 56 | +$$ |
| 57 | +Or, in polar coordinates: |
| 58 | +$$ |
| 59 | + u = f_x tan(\theta) \cos(\varphi) + c_x, \\ |
| 60 | + v = f_y tan(\theta) \sin(\varphi) + c_y. |
| 61 | +$$ |
| 62 | + |
| 63 | +Inversely, we can unproject from 2D camera pixel $\mathbf{p}=(u, v)$ to the homogeneous coordinate of the world point by |
| 64 | +$$ |
| 65 | +x/z=(u-c_x)/f_x, \\ |
| 66 | +y/z=(v-c_y)/f_y. |
| 67 | +$$ |
| 68 | +The linear camera model preserves linearity in 3D space, thus straight lines in the real world are supposed to look straight under the linear camera model. |
| 69 | + |
| 70 | +## The spherical camera model |
| 71 | + |
| 72 | +The spherical camera model is, similarly from the linear camera model parametrized by 4 coefficients : f_x, f_y, c_x, c_y. |
| 73 | +The pixel coordinates are linear to solid angles rather than the homography coordinate system. |
| 74 | +The projection function can be written in polar coordinates |
| 75 | +$$ |
| 76 | + u = f_x \theta \cos(\varphi) + c_x, \\ |
| 77 | + v = f_y \theta \sin(\varphi) + c_y. |
| 78 | +$$ |
| 79 | +Note the difference from the linear camera model — under spherical projection, 3D straight lines look curved in images. |
| 80 | + |
| 81 | +Inversely, we can unproject from 2D camera pixel $\mathbf{p}=(u, v)$ to the homogeneous coordinate of the world point by |
| 82 | +$$ |
| 83 | + \theta = \sqrt{(u - c_x)^2/f_x^2 + (v - c_y)^2/f_y^2}, \\ |
| 84 | + \varphi = \arctan((u - c_x)/f_x, (v - c_y)/f_y). |
| 85 | +$$ |
| 86 | + |
| 87 | +## The KannalaBrandtK3 (KB3) model |
| 88 | + |
| 89 | +The KannalaBrandtK3 model adds radial distortion to the linear model |
| 90 | +$$ |
| 91 | + u = f_x r(\theta) \cos(\varphi) + c_x, \quad |
| 92 | + v = f_y r(\theta) \sin(\varphi) + c_y. |
| 93 | +$$ |
| 94 | +where |
| 95 | +$$ |
| 96 | + r(\theta) = \theta + k_0 \theta^3 + k_1 \theta^5 + k_2 \theta^7 + k_3 \theta^9 + ... |
| 97 | +$$ |
| 98 | +In KannalaBrandtK3 model we use a 9-th order polynomial with four radial distortion parameters $k_0, ... k_3$. |
| 99 | + |
| 100 | +To unproject from camera pixel $(u, v)$ to the world point $(\theta, \varphi)$, we first compute |
| 101 | +$$ |
| 102 | + \varphi = \arctan((u - c_x)/f_x, (v - c_y)/f_y) \\ |
| 103 | + r(\theta) = \sqrt{(u - c_x)^2/f_x^2 + (v - c_y)^2/f_y^2} |
| 104 | +$$ |
| 105 | +Then we use Newton method to inverse the function $r(\theta)$ to compute $\theta$. See the code [here](https://github.com/facebookresearch/projectaria_tools/blob/afad1fe09dd1d89eee55ceb95ba1f2f577f9c606/core/calibration/camera_projections/KannalaBrandtK3.h#L131-L147). |
| 106 | + |
| 107 | +## The Fisheye62 model |
| 108 | + |
| 109 | +The Fisheye62 model adds tangential distortion on top of the KB3 model parametrized by two new coefficients: p_0 p_1. |
| 110 | +$$ |
| 111 | + u = f_x . (u_r + t_x(u_r, v_r)) + c_x, \\ |
| 112 | + v = f_y . (v_r + t_y(u_r, v_r)) + c_y. |
| 113 | +$$ |
| 114 | +where |
| 115 | +$$ |
| 116 | + u_r = r(\theta) \cos(\varphi), \\ |
| 117 | + v_r = r(\theta) \sin(\varphi). |
| 118 | +$$ |
| 119 | +and |
| 120 | +$$ |
| 121 | + t_x(u_r, v_r) = p_0(2 u_r^2 + r(\theta)^2) + 2p_1u_rv_r, \\ |
| 122 | + t_y(u_r, v_r) = p_1(2 v_r^2 + r(\theta)^2) + 2p_0u_rv_r. |
| 123 | +$$ |
| 124 | + |
| 125 | +To unproject from camera pixel $(u, v)$ to the world point $(\theta, \varphi)$, we first use Newton method to compute $u_r$ and $v_r$ from $(u - c_x)/f_x$ and $(v - cy)/f_y$, and then compute $(\theta, \varphi)$ using the above KB3 unproject method. |
| 126 | + |
| 127 | +## The FisheyeRadTanThinPrism (Fisheye624) model |
| 128 | + |
| 129 | +The FisheyeRadTanThinPrism (also called Fisheye624 in file and codebase) models thin-prism distortion (noted $tp$) on top of the Fisheye62 model above. |
| 130 | +Its parametrization contains 4 additional coefficients: s_0 s_1 s_2 s_3. The projection function writes: |
| 131 | +$$ |
| 132 | + u = f_x \cdot (u_r + t_x(u_r, v_r) + tp_x(u_r, v_r)) + c_x, \\ |
| 133 | + v = f_y \cdot (v_r + t_y(u_r, v_r) + tp_y(u_r, v_r)) + c_y. |
| 134 | +$$ |
| 135 | +u_r, v_r, t_x, t_y are defined as in the Fisheye62 model, while $tp_x$ and $tp_y$ are defined as: |
| 136 | +$$ |
| 137 | + tp_x(u_r, v_r) = s_0 r(\theta)^2 + s_1 r(\theta)^4, \\ |
| 138 | + tp_y(u_r, v_r) = s_2 r(\theta)^2 + s_3 r(\theta)^4. |
| 139 | +$$ |
| 140 | + |
| 141 | +To unproject from camera pixel $(u, v)$ to the world point $(\theta, \varphi)$, we first use Newton method to compute $u_r$ and $v_r$ from $(u - c_x)/f_x$ and $(v - cy)/f_y$, and then compute $(\theta, \varphi)$ using the above KB3 unproject method. |
| 142 | + |
| 143 | +Note that in practice, in our codebase and calibration file we assume $f_x$ and $f_y$ are equal. |
0 commit comments