pyvale.render.camera module

Camera data for three dimensional and planar rendering.

class Camera(*, pixels_num, pixels_size, pos_world, rot_world, roi_cent_world, focal_length, subsample=1, distortion_model=EDistortionModel.NONE, distortion_k1=0.0, distortion_k2=0.0, distortion_k3=0.0, distortion_k4=0.0, distortion_k5=0.0, distortion_k6=0.0, distortion_p1=0.0, distortion_p2=0.0, c0=None, c1=None, fstop=None, psf_type=EPSFType.PIXEL_BOX, psf_sigma_x=0.0, psf_sigma_y=0.0, psf_theta=0.0, psf_support_rad=0.0)[source]

Bases: object

A perspective camera data structure.

Parameters:
  • pixels_num (np.ndarray) – Image pixel counts with shape (2,) and dtype int32 in (width, height) order.

  • pixels_size (np.ndarray) – Physical pixel dimensions with shape (2,) and dtype float64 in (width, height) order, in world length units.

  • pos_world (np.ndarray) – Camera position in world coordinates with shape (3,) and dtype float64 representing (X, Y, Z) coordinates.

  • rot_world (scipy.spatial.transform.Rotation) – Camera orientation in world coordinates.

  • roi_cent_world (np.ndarray) – Region of interest centre in world coordinates with shape (3,) and dtype float64 representing (X, Y, Z) coordinates.

  • focal_length (float) – Camera focal length in the same units as world coordinates.

  • subsample (int, optional) – Number of sub pixel samples per pixel direction.

  • distortion_model (EDistortionModel, optional) – Lens distortion model identifier.

  • distortion_k1 (float, optional) – Radial distortion coefficients.

  • distortion_k2 (float, optional) – Radial distortion coefficients.

  • distortion_k3 (float, optional) – Radial distortion coefficients.

  • distortion_k4 (float, optional) – Radial distortion coefficients.

  • distortion_k5 (float, optional) – Additional radial distortion coefficients.

  • distortion_k6 (float, optional) – Additional radial distortion coefficients.

  • distortion_p1 (float, optional) – Tangential distortion coefficients.

  • distortion_p2 (float, optional) – Tangential distortion coefficients.

  • c0 (float or None, optional) – Optical centre coordinates in pixels. None centres the coordinate in the image.

  • c1 (float or None, optional) – Optical centre coordinates in pixels. None centres the coordinate in the image.

  • fstop (float or None, optional) – Lens f number. None leaves depth of field disabled.

  • psf_type (EPSFType, optional) – Point spread function model identifier.

  • psf_sigma_x (float, optional) – Point spread function standard deviations in pixel coordinates.

  • psf_sigma_y (float, optional) – Point spread function standard deviations in pixel coordinates.

  • psf_theta (float, optional) – Point spread function rotation in radians.

  • psf_support_rad (float, optional) – Point spread function support radius in pixels.

pixels_num
pixels_size
pos_world
rot_world
roi_cent_world
focal_length
subsample
distortion_model
distortion_k1
distortion_k2
distortion_k3
distortion_k4
distortion_k5
distortion_k6
distortion_p1
distortion_p2
c0
c1
fstop
psf_type
psf_sigma_x
psf_sigma_y
psf_theta
psf_support_rad
__init__(*, pixels_num, pixels_size, pos_world, rot_world, roi_cent_world, focal_length, subsample=1, distortion_model=EDistortionModel.NONE, distortion_k1=0.0, distortion_k2=0.0, distortion_k3=0.0, distortion_k4=0.0, distortion_k5=0.0, distortion_k6=0.0, distortion_p1=0.0, distortion_p2=0.0, c0=None, c1=None, fstop=None, psf_type=EPSFType.PIXEL_BOX, psf_sigma_x=0.0, psf_sigma_y=0.0, psf_theta=0.0, psf_support_rad=0.0)
class EDistortionModel(*values)[source]

Bases: IntEnum

Lens distortion models matching Riley’s C backend.

Values correspond to the distortion_model field in Riley’s CCameraInput.

NONE = 0
BROWN_CONRADY = 1
BROWN_CONRADY_EXT = 2
POLYNOMIAL = 3
BROWN_CONRADY_POLYNOMIAL = 4
BROWN_CONRADY_EXT_POLYNOMIAL = 5
class EPSFType(*values)[source]

Bases: IntEnum

Point spread function types matching Riley’s PsfType enum.

Values correspond to Riley’s PsfType enum.

PIXEL_BOX = 0
GAUSSIAN = 1
ANISOTROPIC_GAUSSIAN = 2