Camera
Mono/stereo camera models.
Camera(intrinsics=CameraIntrinsics(), distortion=DistortionCoefficients(), extrinsics=Pose3D())
dataclass
Bases: CameraBase
Standard pinhole camera.
Attributes:
| Name | Type | Description |
|---|---|---|
intrinsics |
CameraIntrinsics
|
Intrinsic parameters. |
distortion |
DistortionCoefficients
|
Distortion coefficients. |
extrinsics |
Pose3D
|
Extrinsic parameters. |
project(points, points_frame=None)
Project 3D points into the image plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
3D points as a 3xN numpy array. |
required |
points_frame
|
Optional[Pose3D]
|
Pose of the points frame relative to the camera frame. If None, the points are assumed to be in the camera frame. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Projected points as a 2xN numpy array. |
Source code in src/compas_camcal/models/camera.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
undistort(image)
Undistort an image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
ndarray
|
Image to undistort. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Undistorted image. |
Source code in src/compas_camcal/models/camera.py
112 113 114 115 116 117 118 119 120 121 122 123 124 | |
CameraBase(intrinsics=CameraIntrinsics(), distortion=DistortionCoefficientsBase(), extrinsics=Pose3D())
dataclass
Bases: ABC
Abstract base class for cameras.
Attributes:
| Name | Type | Description |
|---|---|---|
intrinsics |
CameraIntrinsics
|
Intrinsic parameters. |
distortion |
DistortionCoefficientsBase
|
Distortion coefficients. |
extrinsics |
Pose3D
|
Extrinsic parameters. |
project(points, points_frame=None)
abstractmethod
Project 3D points into the image plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
3D points as a 3xN numpy array. |
required |
points_frame
|
Optional[Pose3D]
|
Pose of the points frame relative to the camera frame. If None, the points are assumed to be in the camera frame. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Projected points as a 2xN numpy array. |
Source code in src/compas_camcal/models/camera.py
38 39 40 41 42 43 44 45 46 47 48 49 50 | |
undistort(image)
abstractmethod
Undistort an image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
ndarray
|
Image to undistort. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Undistorted image. |
Source code in src/compas_camcal/models/camera.py
52 53 54 55 56 57 58 59 60 61 62 63 | |
FisheyeCamera(intrinsics=CameraIntrinsics(), distortion=FisheyeDistortionCoefficients(), extrinsics=Pose3D())
dataclass
Bases: CameraBase
Fisheye camera.
Attributes:
| Name | Type | Description |
|---|---|---|
intrinsics |
CameraIntrinsics
|
Intrinsic parameters. |
distortion |
FisheyeDistortionCoefficients
|
Distortion coefficients. |
extrinsics |
Pose3D
|
Extrinsic parameters. |
project(points, points_frame=None)
Project 3D points into the image plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
3D points as a 3xN numpy array. |
required |
points_frame
|
Optional[Pose3D]
|
Pose of the points frame relative to the camera frame. If None, the points are assumed to be in the camera frame. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Projected points as a 2xN numpy array. |
Source code in src/compas_camcal/models/camera.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
undistort(image)
Undistort an image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
ndarray
|
Image to undistort. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Undistorted image. |
Source code in src/compas_camcal/models/camera.py
173 174 175 176 177 178 179 180 181 182 183 184 185 | |
StereoCamera(camera_1, camera_2)
dataclass
Stereo camera pair.
Attributes:
| Name | Type | Description |
|---|---|---|
camera_1 |
CameraBase
|
First camera. By convention, the left camera. |
camera_2 |
CameraBase
|
Second camera. By convention, the right camera. |
relative_pose
property
Calculate the relative pose between the two cameras. This is the pose of camera_2 in camera_1's frame.
Returns:
| Type | Description |
|---|---|
Pose3D
|
Relative pose between the two cameras. |
project(points, points_frame=None)
Project a set of 3D points into both image planes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
3D points as a 3xN numpy array. |
required |
points_frame
|
Optional[Pose3D]
|
Pose of the points frame relative to the camera_1 frame. If None, the points are assumed to be in the camera frame. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Projected points for camera_1 as a 2xN numpy array. |
ndarray
|
Projected points for camera_2 as a 2xN numpy array. |
Source code in src/compas_camcal/models/camera.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |