Skip to content

CameraModel

CameraModel

Camera intrinsics model: focal length, optical center, parity, and distortion.

Encapsulates the mapping between pixel coordinates and tangent-plane coordinates. Supports pickle serialization.

Example::

cam = tetra3rs.CameraModel.from_fov(fov_deg=10.0, image_width=2048, image_height=1536)
xi, eta = cam.pixel_to_tanplane(100.0, 200.0)

focal_length_px property

Focal length in pixels.

image_width property

Image width in pixels.

image_height property

Image height in pixels.

crpix property

Optical center offset from image center [x, y] in pixels.

parity_flip property

Whether the image x-axis is flipped.

distortion property

The distortion model, or None if no distortion.

fov_deg property

Horizontal field of view in degrees.

__init__(focal_length_px, image_width, image_height, crpix=None, parity_flip=False, distortion=None)

Create a camera model with explicit parameters.

Parameters:

Name Type Description Default
focal_length_px float

Focal length in pixels.

required
image_width int

Image width in pixels.

required
image_height int

Image height in pixels.

required
crpix Optional[list[float]]

Optical center offset from image center [x, y]. Default [0, 0].

None
parity_flip bool

Whether x-axis is flipped. Default False.

False
distortion Optional[Union['RadialDistortion', 'PolynomialDistortion']]

A RadialDistortion or PolynomialDistortion. Default None.

None

from_fov(fov_deg, image_width, image_height) staticmethod

Create a camera model from a horizontal field of view and image dimensions.

Parameters:

Name Type Description Default
fov_deg float

Horizontal field of view in degrees.

required
image_width int

Image width in pixels.

required
image_height int

Image height in pixels.

required

Returns:

Type Description
'CameraModel'

CameraModel with no distortion, crpix=[0,0], parity_flip=False.

pixel_scale()

Pixel scale in radians per pixel.

pixel_to_tanplane(px, py)

Convert pixel coordinates to tangent-plane coordinates (xi, eta) in radians.

tanplane_to_pixel(xi, eta)

Convert tangent-plane coordinates to pixel coordinates.