F-Theta Camera

F-Theta Camera Metadata

class py123d.datatypes.FThetaCameraMetadata[source]

Metadata for an f-theta polynomial camera.

Public Data Attributes:

camera_model

The projection model of this camera.

camera_name

The name of the f-theta camera, according to the dataset naming convention.

camera_id

The ID of the f-theta camera.

intrinsics

The FThetaIntrinsics of the f-theta camera, if available.

width

The width of the f-theta camera image in pixels.

height

The height of the f-theta camera image in pixels.

camera_to_imu_se3

The static extrinsic pose of the f-theta camera.

fov_x

The horizontal field of view (FOV) in radians, if available.

fov_y

The vertical field of view (FOV) in radians, if available.

angular_aspect_ratio

The angular aspect ratio (fov_x / fov_y), if available.

Inherited from BaseCameraMetadata

camera_model

The projection model of the camera.

camera_id

The camera ID, unique within a sensor rig.

camera_name

The camera name, according to the dataset naming convention.

camera_to_imu_se3

The static extrinsic pose of the camera relative to the IMU frame.

width

The width of the camera image in pixels.

height

The height of the camera image in pixels.

channel_type

The channel type of the camera image.

modality_type

Returns the type of the modality that this metadata describes.

modality_id

Returns the camera ID as the modality ID.

aspect_ratio

The aspect ratio (width / height) of the camera.

Inherited from BaseModalityMetadata

modality_type

Returns the type of the modality that this metadata describes.

modality_id

Optional identifier for the modality, e.g. sensor ID for sensor modalities.

modality_key

Returns a unique key for this modality, combining type and id if applicable.

Public Methods:

from_dict(data_dict)

Create a FThetaCameraMetadata instance 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 FThetaCameraMetadata instance to a Python dictionary.

Inherited from BaseCameraMetadata

project_to_image(points_cam)

Project 3D points in camera frame to image pixel coordinates.

Inherited from BaseMetadata

to_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 FThetaCameraMetadata instance from a dictionary.

Parameters:

data_dict (Dict[str, Any]) – Dictionary containing camera metadata.

Return type:

FThetaCameraMetadata

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 camera_id: CameraID

The ID of the f-theta camera.

property intrinsics: FThetaIntrinsics | None

The FThetaIntrinsics of the f-theta camera, if available.

property width: int

The width of the f-theta camera image in pixels.

property height: int

The height of the f-theta camera image in pixels.

property camera_to_imu_se3: PoseSE3

The static extrinsic pose of the f-theta camera.

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 - cx to 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 - cy to 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.

to_dict()[source]

Converts the FThetaCameraMetadata instance to a Python dictionary.

Return type:

Dict[str, Any]

Returns:

A dictionary representation of the camera metadata.

F-Theta Intrinsics Index

class py123d.datatypes.FThetaIntrinsicsIndex[source]

Indexing for f-theta camera intrinsic parameters.

Public Data Attributes:

CX

Principal point x-coordinate.

CY

Principal point y-coordinate.

FW_POLY_0

Forward polynomial coefficient 0.

FW_POLY_1

Forward polynomial coefficient 1.

FW_POLY_2

Forward polynomial coefficient 2.

FW_POLY_3

Forward polynomial coefficient 3.

FW_POLY_4

Forward polynomial coefficient 4.

BW_POLY_0

Backward polynomial coefficient 0.

BW_POLY_1

Backward polynomial coefficient 1.

BW_POLY_2

Backward polynomial coefficient 2.

BW_POLY_3

Backward polynomial coefficient 3.

BW_POLY_4

Backward polynomial coefficient 4.

Inherited from int

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

Public Methods:

FW_POLY

BW_POLY

Inherited from int

conjugate

Returns 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:

array

A numpy array representation of the f-theta intrinsics, indexed by FThetaIntrinsicsIndex.

cx

Principal point x-coordinate.

cy

Principal point y-coordinate.

fw_poly

Forward polynomial coefficients (5 values).

bw_poly

Backward polynomial coefficients (5 values).

Inherited from ArrayMixin

array

The array representation of the geometric entity.

shape

Return the shape of the array.

Public Methods:

from_array(array[, copy])

Creates a FThetaIntrinsics from a numpy array, indexed by FThetaIntrinsicsIndex.

Inherited from ArrayMixin

from_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:
  • array (ndarray[tuple[Any, ...], dtype[float64]]) – A 1D numpy array containing the intrinsic parameters.

  • copy (bool) – Whether to copy the array, defaults to True

Return type:

FThetaIntrinsics

Returns:

A FThetaIntrinsics instance.

property array: ndarray[tuple[Any, ...], dtype[float64]]

A numpy array representation of the f-theta intrinsics, indexed by FThetaIntrinsicsIndex.

property cx: float

Principal point x-coordinate.

property cy: float

Principal point y-coordinate.

property fw_poly: ndarray[tuple[Any, ...], dtype[float64]]

Forward polynomial coefficients (5 values).

property bw_poly: ndarray[tuple[Any, ...], dtype[float64]]

Backward polynomial coefficients (5 values).