nextcv.sensors.camera ⚓︎
Sensor representation and manipulation utilities.
| CLASS | DESCRIPTION |
|---|---|
Camera | Represents a camera with its intrinsics, pose, and image resolution. |
PinholeCamera | Represents a pinhole camera with its intrinsics and pose. |
nextcv.sensors.camera.Camera ⚓︎
Bases: BaseModel
Represents a camera with its intrinsics, pose, and image resolution.
| PARAMETER | DESCRIPTION |
|---|---|
width | Image width in pixels TYPE: |
height | Image height in pixels TYPE: |
fx | Focal length along x-axis in pixels TYPE: |
fy | Focal length along y-axis in pixels TYPE: |
cx | Principal point x-coordinate in pixels TYPE: |
cy | Principal point y-coordinate in pixels TYPE: |
roll | Camera roll angle in degrees (rotation around z-axis) TYPE: |
pitch | Camera pitch angle in degrees (rotation around x-axis) TYPE: |
yaw | Camera yaw angle in degrees (rotation around y-axis) TYPE: |
| METHOD | DESCRIPTION |
|---|---|
compute_homography_to | Compute homography matrix that maps points from this cam to target cam. |
from_dict | Create a Camera instance from intrinsics and pose dictionaries. |
maps_from | Create remapping maps from source camera to this camera. |
must_be_even | Ensure width and height are positive integers. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
size | Get the camera size as an opencv-compatible tuple of width and height. |
nextcv.sensors.camera.PinholeCamera ⚓︎
Bases: Camera
Represents a pinhole camera with its intrinsics and pose.
| PARAMETER | DESCRIPTION |
|---|---|
width | Image width in pixels TYPE: |
height | Image height in pixels TYPE: |
fx | Focal length along x-axis in pixels TYPE: |
fy | Focal length along y-axis in pixels TYPE: |
cx | Principal point x-coordinate in pixels TYPE: |
cy | Principal point y-coordinate in pixels TYPE: |
roll | Camera roll angle in degrees (rotation around z-axis) TYPE: |
pitch | Camera pitch angle in degrees (rotation around x-axis) TYPE: |
yaw | Camera yaw angle in degrees (rotation around y-axis) TYPE: |
| METHOD | DESCRIPTION |
|---|---|
compute_homography_to | Compute homography matrix that maps points from this camera to target camera. |
crop | Return a new PinholeCamera cropped by margins (left, top, right, bottom). |
hconcat | Create a virtual camera by concatenating left and right cams horizontally. |
maps_from | Create remapping maps from source camera to this camera. |
vconcat | Create a virtual camera by concatenating top and bottom cams vertically. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
K | Get the camera intrinsics matrix. TYPE: |
R | Get the camera rotation matrix from Euler angles with pinhole convention. TYPE: |
R property ⚓︎
R: ndarray
Get the camera rotation matrix from Euler angles with pinhole convention.
The pinhole convention is: - x is right - y is down - z is forward
compute_homography_to ⚓︎
compute_homography_to(target: PinholeCamera, neg_focal_length: bool = True) -> ndarray
Compute homography matrix that maps points from this camera to target camera.
| PARAMETER | DESCRIPTION |
|---|---|
target | Target camera to compute homography to TYPE: |
neg_focal_length | Whether to negate the focal length TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
ndarray | Homography matrix that transforms points from this camera to target camera |
crop ⚓︎
crop(left: float, top: float, right: float, bottom: float, force_even: bool = True) -> PinholeCamera
Return a new PinholeCamera cropped by margins (left, top, right, bottom).
hconcat classmethod ⚓︎
hconcat(left: PinholeCamera, right: PinholeCamera) -> PinholeCamera
Create a virtual camera by concatenating left and right cams horizontally.
maps_from ⚓︎
maps_from(src: PinholeCamera, neg_focal_length: bool = True) -> Tuple[ndarray, ndarray]
Create remapping maps from source camera to this camera.
vconcat classmethod ⚓︎
vconcat(top: PinholeCamera, bottom: PinholeCamera) -> PinholeCamera
Create a virtual camera by concatenating top and bottom cams vertically.