OpenCVModel.pixels_to_gnomic

giant.camera_models.opencv_model:

OpenCVModel.pixels_to_gnomic(pixels, temperature=0, _allow_interp=False)

This method takes an input in pixels and computes the undistorted gnomic location in units of distance.

This conversion is done iteratively (when there is a distortion model involved). First, the pixel locations are converted to units of distance and re-centered at the principal point by multiplying by the inverse intrinsic matrix.

\[\begin{split}\mathbf{x}_I'=\mathbf{K}^{-1}\left[\begin{array}{c} \mathbf{x}_P \\ 1 \end{array}\right]\end{split}\]

Next, if there is a distortion model, the distortion is removed iteratively using a fixed point algorithm.

\[\begin{split}\mathbf{x}_{Ip}' = d(\mathbf{x}_{Ip}) \\ \mathbf{x}_{In} = \mathbf{x}_{Ip} + (\mathbf{x}_I' - \mathbf{x}_{Ip}')\end{split}\]

where a subscript of \(p\) indicates the previous iteration’s value, a subscript of \(n\) indicates the new value, and \(d()\) is the distortion model (method apply_distortion()). This iteration is repeated until the solution converges, or 20 iterations have been performed.

The final iteration’s value of the undistorted gnomic points are returned.

Parameters:
  • pixels (Sequence | ndarray) – The pixels to be converted as a shape (2,) or (2, n) Sequence

  • temperature (Real) – The temperature for perform the conversion at.

  • _allow_interp (bool) – A flag allowing this to dispatch to the interpolation based conversion in pixels_to_gnomic_interp()

Returns:

The undistorted gnomic location of the points

Return type:

ndarray