sym.spherical_camera_cal module#

class SphericalCameraCal(focal_length, principal_point, critical_theta, distortion_coeffs)[source]#

Bases: object

Autogenerated Python implementation of symforce.cam.spherical_camera_cal.SphericalCameraCal.

Kannala-Brandt camera model, where radial distortion is modeled relative to the 3D angle theta off the optical axis as opposed to radius within the image plane (i.e. ATANCamera)

I.e. the radius in the image plane as a function of the angle theta from the camera z-axis is assumed to be given by:

r(theta) = theta + d[0] * theta^3 + d[1] * theta^5 + d[2] * theta^7 + d[3] * theta^9

This model also includes two tangential coefficients, implemented similar to the Brown-Conrady model. For details, see the Fisheye62 model from Project Aria: https://facebookresearch.github.io/projectaria_tools/docs/tech_insights/camera_intrinsic_models

With no tangential coefficients, this model is over-parameterized in that we may scale all the distortion coefficients by a constant, and the focal length by the inverse of that constant. To fix this issue, we peg the first coefficient at 1. So while the distortion dimension is ‘4’, the actual total number of coeffs is 5.

Additionally, the storage for this class includes the critical theta, the maximum angle from the optical axis where projection is invertible; although the critical theta is a function of the other parameters, this function requires polynomial root finding, so it should be computed externally at runtime and set to the computed value.

Paper:

A generic camera model and calibration method for conventional, wide-angle, and fish-eye lenses
Kannala, Juho; Brandt, Sami S.
PAMI 2006

This is the simpler “P9” model without any non-radially-symmetric distortion params, but also includes two tangential distortion params similar to the Brown-Conrady model.

The storage for this class is:

[ fx fy cx cy critical_theta d0 d1 d2 d3 p0 p1]

Parameters:
data: List[float]#
focal_length()[source]#

Return the focal length.

Return type:

ndarray

principal_point()[source]#

Return the principal point.

Return type:

ndarray

pixel_from_camera_point(point, epsilon)[source]#

Project a 3D point in the camera frame into 2D pixel coordinates.

Returns:
  • pixel – (x, y) coordinate in pixels if valid

  • is_valid – 1 if the operation is within bounds else 0

Parameters:
Return type:

Tuple[ndarray, float]

pixel_from_camera_point_with_jacobians(point, epsilon)[source]#

Project a 3D point in the camera frame into 2D pixel coordinates.

Returns:
  • pixel – (x, y) coordinate in pixels if valid

  • is_valid – 1 if the operation is within bounds else 0

  • pixel_D_cal – Derivative of pixel with respect to intrinsic calibration parameters

  • pixel_D_point – Derivative of pixel with respect to point

Parameters:
Return type:

Tuple[ndarray, float, ndarray, ndarray]

static storage_dim()[source]#
Return type:

int

to_storage()[source]#
Return type:

List[float]

classmethod from_storage(vec)[source]#
Parameters:

vec (Sequence[float]) –

Return type:

SphericalCameraCal

static tangent_dim()[source]#
Return type:

int

classmethod from_tangent(vec, epsilon=1e-08)[source]#
Parameters:
Return type:

SphericalCameraCal

to_tangent(epsilon=1e-08)[source]#
Parameters:

epsilon (float) –

Return type:

ndarray

retract(vec, epsilon=1e-08)[source]#
Parameters:
Return type:

SphericalCameraCal

local_coordinates(b, epsilon=1e-08)[source]#
Parameters:
Return type:

ndarray

interpolate(b, alpha, epsilon=1e-08)[source]#
Parameters:
Return type:

SphericalCameraCal