Dealing with a 200° FOV Fisheye Camera

This project started from a practical problem: building an MCMT (Multi-Camera Multi-Object Tracking) system using dual cameras on a physical access control device.

Reference


Initial Idea: Triangulation with Dual Cameras

My first approach was straightforward:

  • Use two cameras
  • Apply triangulation
  • Estimate the 3D position of objects in space

To achieve this, we must map each image pixel to a 3D ray in the real world.

Fisheye vs Ultra Wide-Angle Lens

Use this image for example best described as:

  • Diagonal fisheye lens, or
  • Ultra wide-angle lens (>180° FOV)

These lenses require nonlinear projection models.


Camera Models for Wide FOV

For fisheye and ultra wide-angle lenses, we need a more general model.

Kannala-Brandt Fisheye Projection Model

This is a widely used generic model for fisheye cameras.

P=[xyz]f=focal lengthd=x2+y2θ=arctan2(d,z)(angle from optical axis)φ=arctan2(y,x)r={ftan(θ)(perspective)2ftan(θ/2)(stereographic)fθ(equidistant)2fsin(θ/2)(equisolid angle)fsin(θ)(orthographic)fi=15kiθ2i1(polynomial general form)p=[rcos(φ)rsin(φ)][uv]=[fxpx+cxfypy+cy]\begin{aligned} P &= \begin{bmatrix} x \\ y \\ z \end{bmatrix} \\ f &= \text{focal length} \\ d &= \sqrt{x^2 + y^2} \\ \theta &= \arctan2(d, z) \quad \text{(angle from optical axis)} \\ \varphi &= \arctan2(y, x) \\ \\ r &= \begin{cases} f \tan(\theta) & \text{(perspective)} \\ 2f \tan(\theta/2) & \text{(stereographic)} \\ f \theta & \text{(equidistant)} \\ 2f \sin(\theta/2) & \text{(equisolid angle)} \\ f \sin(\theta) & \text{(orthographic)} \\ f \sum_{i=1}^{5} k_i \theta^{2i-1} & \text{(polynomial general form)} \end{cases} \\ \\ p &= \begin{bmatrix} r \cos(\varphi) \\ r \sin(\varphi) \end{bmatrix} \\ \\ \begin{bmatrix} u \\ v \end{bmatrix} &= \begin{bmatrix} f_x p_x + c_x \\ f_y p_y + c_y \end{bmatrix} \end{aligned}

This model supports multiple projection types and is flexible enough to fit real fisheye lenses.


Unprojection: From Pixel to 3D Ray

To perform triangulation, we need to reverse the projection:

px=ucxfx,py=vcyfyr=px2+py2φ=arctan2(py,px)θ=2arcsin(r2f)(example: equisolid projection)ray=[sin(θ)cos(φ)sin(θ)sin(φ)cos(θ)]\begin{aligned} p_x &= \frac{u - c_x}{f_x}, \quad p_y = \frac{v - c_y}{f_y} \\ r &= \sqrt{p_x^2 + p_y^2} \\ \varphi &= \arctan2(p_y, p_x) \\ \theta &= 2 \arcsin\left(\frac{r}{2f}\right) \quad \text{(example: equisolid projection)} \\ \mathbf{ray} &= \begin{bmatrix} \sin(\theta)\cos(\varphi) \\ \sin(\theta)\sin(\varphi) \\ \cos(\theta) \end{bmatrix} \end{aligned}

This gives us a unit direction vector in 3D space corresponding to a pixel.


Reference