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:
focal_length (T.Union[T.Sequence[float], numpy.ndarray]) –
principal_point (T.Union[T.Sequence[float], numpy.ndarray]) –
critical_theta (float) –
distortion_coeffs (T.Union[T.Sequence[float], numpy.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:
point (SphericalCameraCal) –
epsilon (ndarray) –
- Return type:
- 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:
point (SphericalCameraCal) –
epsilon (ndarray) –
- Return type:
- local_coordinates(b, epsilon=1e-08)[source]#
- Parameters:
b (SphericalCameraCal) –
epsilon (float) –
- Return type:
- interpolate(b, alpha, epsilon=1e-08)[source]#
- Parameters:
b (SphericalCameraCal) –
alpha (float) –
epsilon (float) –
- Return type: