symforce.cam.posed_camera module#

class PosedCamera(pose, calibration, image_size=None)[source]#

Bases: Camera

Camera with a given pose, camera calibration, and an optionally specified image size.

If the image size is specified, we use it to check whether pixels (either given or computed by projection of 3D points into the image frame) are in the image frame and thus valid/invalid.

Parameters:
PosedCameraT = ~PosedCameraT#
pixel_from_global_point(point, epsilon=0.0)[source]#

Transforms the given point into the camera frame using the given camera pose, and then uses the given camera calibration to compute the resulted pixel coordinates of the projected point.

Parameters:
  • point (Matrix31) – Vector written in camera frame.

  • epsilon (float) – Small value intended to prevent division by 0.

Returns:
  • pixel – UV coordinates in pixel units, assuming the point is in view

  • is_valid – 1 if point is valid

Return type:

Tuple[Matrix21, float]

global_point_from_pixel(pixel, range_to_point, epsilon=0.0)[source]#

Computes a point written in the global frame along the ray passing through the center of the given pixel. The point is positioned at a given range along the ray.

Parameters:
  • pixel (Matrix21) – Vector in pixels in camera image.

  • range_to_point (float) – Distance of the returned point along the ray passing through pixel

  • epsilon (float) – Small value intended to prevent division by 0.

Returns:
  • global_point – The point in the global frame.

  • is_valid – 1 if point is valid

Return type:

Tuple[Matrix31, float]

warp_pixel(pixel, inverse_range, target_cam, epsilon=0.0)[source]#

Project a pixel in this camera into another camera.

Parameters:
  • pixel (Matrix21) – Pixel in the source camera

  • inverse_range (float) – Inverse distance along the ray to the global point

  • target_cam (PosedCamera) – Camera to project global point into

  • epsilon (float) –

Returns:
  • pixel – Pixel in the target camera

  • is_valid – 1 if given point is valid in source camera and target camera

Return type:

Tuple[Matrix21, float]

subs(*args, **kwargs)[source]#

Substitute given values of each scalar element into a new instance.

Parameters:
  • self (PosedCameraT) –

  • args (T.Any) –

  • kwargs (T.Any) –

Return type:

PosedCameraT

image_size: Matrix21 | None#