symforce.cam.camera_cal module¶
- class CameraCal(focal_length, principal_point, distortion_coeffs=())[source]¶
Bases:
Storage
Base class for symbolic camera models.
- Parameters:
focal_length (
Sequence
[float
]) –principal_point (
Sequence
[float
]) –distortion_coeffs (
Sequence
[float
]) –
- NUM_DISTORTION_COEFFS = 0¶
- __init__(focal_length, principal_point, distortion_coeffs=())[source]¶
- Parameters:
focal_length (
Sequence
[float
]) –principal_point (
Sequence
[float
]) –distortion_coeffs (
Sequence
[float
]) –
- classmethod from_distortion_coeffs(focal_length, principal_point, distortion_coeffs=())[source]¶
Construct a Camera Cal of type cls from the focal_length, principal_point, and distortion_coeffs.
Note, some subclasses may not allow symbolic arguments unless additional keyword arguments are passed in.
- Parameters:
cls (
Type
[~CameraCalT]) –focal_length (
Sequence
[float
]) –principal_point (
Sequence
[float
]) –distortion_coeffs (
Sequence
[float
]) –
- Return type:
~CameraCalT
- 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
], …]
- 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:
cls (
Type
[~CameraCalT]) –vec (
Sequence
[float
]) –
- Return type:
~CameraCalT
- 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:
cls (
Type
[~CameraCalT]) –name (
str
) –kwargs (
Any
) –
- Return type:
~CameraCalT
- 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:
point (
Matrix31
) –epsilon (
float
) –
- camera_ray_from_pixel(pixel, epsilon=0.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:
pixel (
Matrix21
) –epsilon (
float
) –