symforce.cam.camera module¶
- class Camera(calibration, image_size=None)[source]¶
Bases:
object
Camera with a given camera calibration and an optionally specified image size (width, height). 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:
calibration (
CameraCal
) –image_size (
Optional
[Sequence
[float
]]) –
- __init__(calibration, image_size=None)[source]¶
- Parameters:
calibration (
CameraCal
) –image_size (
Optional
[Sequence
[float
]]) –
- pixel_from_camera_point(point, epsilon=0.0)[source]¶
Project a 3D point in the camera frame into 2D pixel coordinates.
- Returns:
(x, y) coordinate in pixels if valid is_valid: 1 if the operation is within bounds (including image_size bounds) else 0
- Return type:
pixel
- Parameters:
point (
Matrix31
) –epsilon (
float
) –
- camera_ray_from_pixel(pixel, epsilon=0.0, normalize=False)[source]¶
Backproject a 2D pixel coordinate into a 3D ray in the camera frame.
NOTE: If image_size is specified and the given pixel is out of bounds, is_valid will be set to zero.
- Parameters:
normalize (
bool
) – Whether camera_ray will be normalized (False by default)pixel (
Matrix21
) –epsilon (
float
) –
- Returns:
The ray in the camera frame is_valid: 1 if the operation is within bounds else 0
- Return type:
camera_ray
- has_camera_ray_from_pixel()[source]¶
Returns True if self has implemented the method camera_ray_from_pixel, and False otherwise.
- Return type:
bool