Pinhole Camera

Pinhole Camera Data

class py123d.datatypes.sensors.PinholeCamera[source]

Represents the recording of a pinhole camera including its metadata, image, and extrinsic pose.

Public Data Attributes:

metadata

The static PinholeCameraMetadata associated with the pinhole camera.

image

The image captured by the pinhole camera, as a numpy array.

extrinsic

The extrinsic PoseSE3 of the pinhole camera, relative to the ego vehicle frame.


property metadata: PinholeCameraMetadata

The static PinholeCameraMetadata associated with the pinhole camera.

property image: ndarray[tuple[Any, ...], dtype[uint8]]

The image captured by the pinhole camera, as a numpy array.

property extrinsic: PoseSE3

The extrinsic PoseSE3 of the pinhole camera, relative to the ego vehicle frame.

Pinhole Metadata

class py123d.datatypes.sensors.PinholeCameraMetadata[source]

Static metadata for a pinhole camera, stored in a log.

Public Data Attributes:

camera_type

The PinholeCameraType of the pinhole camera.

intrinsics

The PinholeIntrinsics of the pinhole camera.

distortion

The PinholeDistortion of the pinhole camera.

width

The image width in pixels.

height

The image height in pixels.

aspect_ratio

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

fov_x

The horizontal field of view (FOV) of the pinhole camera in radians.

fov_y

The vertical field of view (FOV) of the pinhole camera in radians.

Public Methods:

from_dict(data_dict)

Create a PinholeCameraMetadata from a dictionary.

to_dict()

Converts the PinholeCameraMetadata to a dictionary.


classmethod from_dict(data_dict)[source]

Create a PinholeCameraMetadata from a dictionary.

Parameters:

data_dict (Dict[str, Any]) – A dictionary containing the metadata.

Return type:

PinholeCameraMetadata

Returns:

A PinholeCameraMetadata instance.

to_dict()[source]

Converts the PinholeCameraMetadata to a dictionary.

Return type:

Dict[str, Any]

Returns:

A dictionary representation of the PinholeCameraMetadata instance, with default Python types.

property camera_type: PinholeCameraType

The PinholeCameraType of the pinhole camera.

property intrinsics: PinholeIntrinsics | None

The PinholeIntrinsics of the pinhole camera.

property distortion: PinholeDistortion | None

The PinholeDistortion of the pinhole camera.

property width: int

The image width in pixels.

property height: int

The image height in pixels.

property aspect_ratio: float

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

property fov_x: float

The horizontal field of view (FOV) of the pinhole camera in radians.

property fov_y: float

The vertical field of view (FOV) of the pinhole camera in radians.

Pinhole Intrinsics

class py123d.datatypes.sensors.PinholeIntrinsics[source]

Pinhole camera intrinsics representation.

Public Data Attributes:

array

A numpy array representation of the pinhole intrinsics, indexed by PinholeIntrinsicsIndex.

fx

Focal length in x direction.

fy

Focal length in y direction.

cx

Optical center x coordinate.

cy

Optical center y coordinate.

skew

Skew coefficient.

camera_matrix

The 3x3 camera intrinsic matrix K.

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 PinholeIntrinsics from a numpy array, indexed by PinholeIntrinsicsIndex.

from_camera_matrix(intrinsic)

Create a PinholeIntrinsics from a 3x3 intrinsic matrix.

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 PinholeIntrinsics from a numpy array, indexed by PinholeIntrinsicsIndex.

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:

PinholeIntrinsics

Returns:

A PinholeIntrinsics instance.

classmethod from_camera_matrix(intrinsic)[source]

Create a PinholeIntrinsics from a 3x3 intrinsic matrix.

Parameters:

intrinsic (ndarray[tuple[Any, ...], dtype[float64]]) – A 3x3 numpy array representing the intrinsic matrix.

Return type:

PinholeIntrinsics

Returns:

A PinholeIntrinsics instance.

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

A numpy array representation of the pinhole intrinsics, indexed by PinholeIntrinsicsIndex.

property fx: float

Focal length in x direction.

property fy: float

Focal length in y direction.

property cx: float

Optical center x coordinate.

property cy: float

Optical center y coordinate.

property skew: float

Skew coefficient. Not used in most cases.

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

The 3x3 camera intrinsic matrix K.

Pinhole Distortion

class py123d.datatypes.sensors.PinholeDistortion[source]

Pinhole camera distortion representation.

Public Data Attributes:

array

A numpy array representation of the pinhole distortion, indexed by PinholeDistortionIndex.

k1

Radial distortion coefficient k1.

k2

Radial distortion coefficient k2.

p1

Tangential distortion coefficient p1.

p2

Tangential distortion coefficient p2.

k3

Radial distortion coefficient k3.

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 PinholeDistortion from a numpy array, indexed by PinholeDistortionIndex.

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 PinholeDistortion from a numpy array, indexed by PinholeDistortionIndex.

Parameters:
  • array (ndarray[tuple[Any, ...], dtype[float64]]) – A 1D numpy array containing the distortion parameters.

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

Return type:

PinholeDistortion

Returns:

A PinholeDistortion instance.

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

A numpy array representation of the pinhole distortion, indexed by PinholeDistortionIndex.

property k1: float

Radial distortion coefficient k1.

property k2: float

Radial distortion coefficient k2.

property p1: float

Tangential distortion coefficient p1.

property p2: float

Tangential distortion coefficient p2.

property k3: float

Radial distortion coefficient k3.

Pinhole Camera Types

class py123d.datatypes.sensors.PinholeCameraType[source]

Enumeration of pinhole camera types.

PCAM_F0 = 0

Front camera.

PCAM_B0 = 1

Back camera.

PCAM_L0 = 2

Left camera, first from front to back.

PCAM_L1 = 3

Left camera, second from front to back.

PCAM_L2 = 4

Left camera, third from front to back.

PCAM_R0 = 5

Right camera, first from front to back.

PCAM_R1 = 6

Right camera, second from front to back.

PCAM_R2 = 7

Right camera, third from front to back.

PCAM_STEREO_L = 8

Left stereo camera.

PCAM_STEREO_R = 9

Right stereo camera.