F-Theta Camera¶
F-Theta Camera Metadata¶
- class py123d.datatypes.FThetaCameraMetadata[source]¶
Metadata for an f-theta polynomial camera.
Public Data Attributes:
camera_modelThe projection model of this camera.
camera_nameThe name of the f-theta camera, according to the dataset naming convention.
camera_idThe ID of the f-theta camera.
intrinsicsThe
FThetaIntrinsicsof the f-theta camera, if available.widthThe width of the f-theta camera image in pixels.
heightThe height of the f-theta camera image in pixels.
camera_to_imu_se3The static extrinsic pose of the f-theta camera.
fov_xThe horizontal field of view (FOV) in radians, if available.
fov_yThe vertical field of view (FOV) in radians, if available.
angular_aspect_ratioThe angular aspect ratio (fov_x / fov_y), if available.
Inherited from
BaseCameraMetadatacamera_modelThe projection model of the camera.
camera_idThe camera ID, unique within a sensor rig.
camera_nameThe camera name, according to the dataset naming convention.
camera_to_imu_se3The static extrinsic pose of the camera relative to the IMU frame.
widthThe width of the camera image in pixels.
heightThe height of the camera image in pixels.
channel_typeThe channel type of the camera image.
modality_typeReturns the type of the modality that this metadata describes.
modality_idReturns the camera ID as the modality ID.
aspect_ratioThe aspect ratio (width / height) of the camera.
Inherited from
BaseModalityMetadatamodality_typeReturns the type of the modality that this metadata describes.
modality_idOptional identifier for the modality, e.g. sensor ID for sensor modalities.
modality_keyReturns a unique key for this modality, combining type and id if applicable.
Public Methods:
from_dict(data_dict)Create a
FThetaCameraMetadatainstance from a dictionary.project_to_image(points_cam)Project 3D points in camera frame to image pixel coordinates using the f-theta model.
to_dict()Converts the
FThetaCameraMetadatainstance to a Python dictionary.Inherited from
BaseCameraMetadataproject_to_image(points_cam)Project 3D points in camera frame to image pixel coordinates.
Inherited from
BaseMetadatato_dict()Serialize the metadata instance to a plain Python dictionary.
from_dict(data_dict)Construct a metadata instance from a plain Python dictionary.
Private Methods:
_evaluate_bw_poly(r)Evaluate the backward polynomial at pixel radius r.
Inherited from
BaseCameraMetadata_compute_in_fov_mask(pixel_coords, depth[, eps])Compute a boolean mask for points in front of the camera and within image bounds.
- classmethod from_dict(data_dict)[source]¶
Create a
FThetaCameraMetadatainstance from a dictionary.- Parameters:
data_dict (
Dict[str,Any]) – Dictionary containing camera metadata.- Return type:
- Returns:
A new instance of
FThetaCameraMetadata.
- property camera_model: CameraModel¶
The projection model of this camera.
- property camera_name: str¶
The name of the f-theta camera, according to the dataset naming convention.
- property intrinsics: FThetaIntrinsics | None¶
The
FThetaIntrinsicsof the f-theta camera, if available.
- project_to_image(points_cam)[source]¶
Project 3D points in camera frame to image pixel coordinates using the f-theta model.
Uses the forward polynomial to map ray angle to pixel distance from principal point.
- Parameters:
points_cam (
ndarray[tuple[Any,...],dtype[float64]]) – (N, 3) array of 3D points in the camera coordinate frame.- Return type:
Tuple[ndarray[tuple[Any,...],dtype[float64]],ndarray[tuple[Any,...],dtype[bool]],ndarray[tuple[Any,...],dtype[float64]]]- Returns:
A tuple of (pixel_coords (N,2), in_fov_mask (N,), depth (N,)).
- Raises:
ValueError – If intrinsics are not set.
- property fov_x: float | None¶
The horizontal field of view (FOV) in radians, if available.
Computed by evaluating the backward polynomial at the pixel distances from the principal point to the left and right image edges (at pixel-centre coordinates), then summing the two half-angles.
The right-edge distance uses
width - 1 - cxto stay within the last valid pixel centre rather than past the sensor boundary.
- property fov_y: float | None¶
The vertical field of view (FOV) in radians, if available.
Computed by evaluating the backward polynomial at the pixel distances from the principal point to the top and bottom image edges (at pixel-centre coordinates), then summing the two half-angles.
The bottom-edge distance uses
height - 1 - cyto stay within the last valid pixel centre rather than past the sensor boundary.
- property angular_aspect_ratio: float | None¶
The angular aspect ratio (fov_x / fov_y), if available.
For f-theta cameras, the angular aspect ratio differs from the pixel aspect ratio (width / height) because the polynomial projection is non-linear. Viewers that assume pinhole geometry should use this ratio instead of
aspect_ratio.
F-Theta Intrinsics Index¶
- class py123d.datatypes.FThetaIntrinsicsIndex[source]¶
Indexing for f-theta camera intrinsic parameters.
Public Data Attributes:
CXPrincipal point x-coordinate.
CYPrincipal point y-coordinate.
FW_POLY_0Forward polynomial coefficient 0.
FW_POLY_1Forward polynomial coefficient 1.
FW_POLY_2Forward polynomial coefficient 2.
FW_POLY_3Forward polynomial coefficient 3.
FW_POLY_4Forward polynomial coefficient 4.
BW_POLY_0Backward polynomial coefficient 0.
BW_POLY_1Backward polynomial coefficient 1.
BW_POLY_2Backward polynomial coefficient 2.
BW_POLY_3Backward polynomial coefficient 3.
BW_POLY_4Backward polynomial coefficient 4.
Inherited from
intrealthe real part of a complex number
imagthe imaginary part of a complex number
numeratorthe numerator of a rational number in lowest terms
denominatorthe denominator of a rational number in lowest terms
Public Methods:
FW_POLYBW_POLYInherited from
intconjugateReturns self, the complex conjugate of any int.
bit_length()Number of bits necessary to represent self in binary.
bit_count()Number of ones in the binary representation of the absolute value of self.
to_bytes([length, byteorder, signed])Return an array of bytes representing an integer.
from_bytes(bytes[, byteorder, signed])Return the integer represented by the given array of bytes.
as_integer_ratio()Return integer ratio.
Private Methods:
_generate_next_value_(start, count, last_values)Generate the next value when not given.
_value_repr_()Return repr(self).
Inherited from
IntEnum_generate_next_value_(start, count, last_values)Generate the next value when not given.
_value_repr_()Return repr(self).
Inherited from
ReprEnum_generate_next_value_(start, count, last_values)Generate the next value when not given.
Inherited from
Enum_generate_next_value_(start, count, last_values)Generate the next value when not given.
_missing_(value)_new_member_(value)Create and return a new object.
- CX = 0¶
Principal point x-coordinate.
- CY = 1¶
Principal point y-coordinate.
- FW_POLY_0 = 2¶
Forward polynomial coefficient 0.
- FW_POLY_1 = 3¶
Forward polynomial coefficient 1.
- FW_POLY_2 = 4¶
Forward polynomial coefficient 2.
- FW_POLY_3 = 5¶
Forward polynomial coefficient 3.
- FW_POLY_4 = 6¶
Forward polynomial coefficient 4.
- BW_POLY_0 = 7¶
Backward polynomial coefficient 0.
- BW_POLY_1 = 8¶
Backward polynomial coefficient 1.
- BW_POLY_2 = 9¶
Backward polynomial coefficient 2.
- BW_POLY_3 = 10¶
Backward polynomial coefficient 3.
- BW_POLY_4 = 11¶
Backward polynomial coefficient 4.
- FW_POLY = slice(<FThetaIntrinsicsIndex.FW_POLY_0: 2>, 7, None)¶
- BW_POLY = slice(<FThetaIntrinsicsIndex.BW_POLY_0: 7>, 12, None)¶
- __new__(value)¶
- conjugate()¶
Returns self, the complex conjugate of any int.
- bit_length()¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- as_integer_ratio()¶
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real¶
the real part of a complex number
- imag¶
the imaginary part of a complex number
- numerator¶
the numerator of a rational number in lowest terms
- denominator¶
the denominator of a rational number in lowest terms
F-Theta Intrinsics¶
- class py123d.datatypes.FThetaIntrinsics[source]¶
F-theta camera intrinsics with forward and backward polynomial distortion coefficients.
Public Data Attributes:
arrayA numpy array representation of the f-theta intrinsics, indexed by
FThetaIntrinsicsIndex.cxPrincipal point x-coordinate.
cyPrincipal point y-coordinate.
fw_polyForward polynomial coefficients (5 values).
bw_polyBackward polynomial coefficients (5 values).
Inherited from
ArrayMixinarrayThe array representation of the geometric entity.
shapeReturn the shape of the array.
Public Methods:
from_array(array[, copy])Creates a FThetaIntrinsics from a numpy array, indexed by
FThetaIntrinsicsIndex.Inherited from
ArrayMixinfrom_array(array[, copy])Create an instance from a NumPy array.
from_list(values)Create an instance from a list of values.
tolist()Convert the array to a Python list.
to_list()Convert the array to a Python list.
copy()Return a copy of the object with a copied array.
- classmethod from_array(array, copy=True)[source]¶
Creates a FThetaIntrinsics from a numpy array, indexed by
FThetaIntrinsicsIndex.- Parameters:
- Return type:
- Returns:
A
FThetaIntrinsicsinstance.
- property array: ndarray[tuple[Any, ...], dtype[float64]]¶
A numpy array representation of the f-theta intrinsics, indexed by
FThetaIntrinsicsIndex.