# symforce.cam.polynomial_camera_cal module¶

class PolynomialCameraCal(focal_length, principal_point, distortion_coeffs=(0.0, 0.0, 0.0), critical_undistorted_radius=None, max_fov=2.0943951023931953)[source]

Bases: `CameraCal`

Polynomial camera model in the style of OpenCV. Distortion is a multiplicitive factor applied to the image plane coordinates in the camera frame. Mapping between distorted image plane coordinates and image coordinates is done using a standard linear model.

The distortion function is a 6th order even polynomial that is a function of the radius of the image plane coordinates. r = (p_img ** 2 + p_img**2) ** 0.5 distorted_weight = 1 + c0 * r^2 + c1 * r^4 + c2 * r^6 uv = p_img * distorted_weight

Parameters:
• focal_length (`Sequence`[`float`]) –

• principal_point (`Sequence`[`float`]) –

• distortion_coeffs (`Sequence`[`float`]) –

• critical_undistorted_radius (`Optional`[`float`]) –

• max_fov (`float`) –

NUM_DISTORTION_COEFFS = 3
DEFAULT_MAX_FOV = 2.0943951023931953
__init__(focal_length, principal_point, distortion_coeffs=(0.0, 0.0, 0.0), critical_undistorted_radius=None, max_fov=2.0943951023931953)[source]
Parameters:
• critical_undistorted_radius (`Optional`[`float`]) – The maximum radius allowable for distortion. This should be as large as largest expected undistorted radius. If the distortion coeffs are all numerical, this will be computed automatically as either the first local maximum of r(radius) in the interval (0, max_radius), or as max_radius if there is no local maximum in the interval.

• max_fov (`float`) – Only used to compute critical_undistorted_radius when all camera parameters are numerical. The maximum FOV (field of view) determines the maximum image plane coordinates which is used to compute maximum radius.

• focal_length (`Sequence`[`float`]) –

• principal_point (`Sequence`[`float`]) –

• distortion_coeffs (`Sequence`[`float`]) –

classmethod from_distortion_coeffs(focal_length, principal_point, distortion_coeffs=(), **kwargs)[source]

Construct a Camera Cal of type cls from the focal_length, principal_point, and distortion_coeffs.

kwargs are additional arguments which will be passed to the constructor.

Symbolic arguments may only be passed if the kwarg critical_undistorted_radius is passed.

Parameters:
• focal_length (`Sequence`[`float`]) –

• principal_point (`Sequence`[`float`]) –

• distortion_coeffs (`Sequence`[`float`]) –

• kwargs (`float`) –

Return type:

`PolynomialCameraCal`

classmethod storage_order()[source]

Return list of the names of values returned in the storage paired with the dimension of each value.

Return type:

`Tuple`[`Tuple`[`str`, `int`], …]

pixel_from_camera_point(point, epsilon=0.0)[source]

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

Returns:

(x, y) coordinate in pixels if valid is_valid: 1 if the operation is within bounds else 0

Return type:

pixel

Parameters:
camera_ray_from_pixel(pixel, epsilon=0)[source]

Backproject a 2D pixel coordinate into a 3D ray in the camera frame.

TODO(hayk): Add a normalize boolean argument? Like in cam.Camera

Returns:

The ray in the camera frame (NOT normalized) is_valid: 1 if the operation is within bounds else 0

Return type:

camera_ray

Parameters:
classmethod storage_dim()[source]

Dimension of underlying storage

Return type:

`int`

to_storage()[source]

Flat list representation of the underlying storage, length of STORAGE_DIM. This is used purely for plumbing, it is NOT like a tangent space.

Return type:

`List`[`float`]

classmethod from_storage(vec)[source]

Construct from a flat list representation. Opposite of .to_storage().

Parameters:

vec (`Sequence`[`float`]) –

Return type:

`PolynomialCameraCal`

classmethod symbolic(name, **kwargs)[source]

Construct a symbolic element with the given name prefix. Kwargs are forwarded to sf.Symbol (for example, sympy assumptions).

Parameters:
• name (`str`) –

• kwargs (`Any`) –

Return type:

`PolynomialCameraCal`