OpNavManager#
- class OpNavManager#
Bases:
objectPinhole camera projection shared by the optical measurement models.
A stateless collection of the calibration matrix, the pinhole projection and its Jacobian, so the projection and its derivative have exactly one implementation and stay in step.
All methods are class or static methods; the class is never instantiated.
Methods
calibration_matrix(camera)Return the pinhole calibration matrix K of a camera.
project(camera, points_camera)Pinhole-project
(N, 3)camera-frame vectors to(N, 2)pixels.project_jacobian(camera, point_camera)Return
d(u, v) / d r_cam— the pinhole projection Jacobian.See also
scarabaeus.CentroidingIdealCentroid model built on this projection.
- classmethod project(camera, points_camera: ndarray) → ndarray#
Pinhole-project
(N, 3)camera-frame vectors to(N, 2)pixels.- Parameters:
- cameraCamera
The camera supplying the calibration matrix.
- points_cameranumpy.ndarray
(N, 3)vectors from the camera to the points, in the camera frame.
- Returns:
- numpy.ndarray
(N, 2)pixel coordinates.
- classmethod project_jacobian(camera, point_camera: ndarray) → ndarray#
Return
d(u, v) / d r_cam— the pinhole projection Jacobian.Differentiates
project()for a single point: \(u = f_x x/z + c_x\) and \(v = f_y y/z + c_y\), so\[\begin{split}\frac{\partial(u, v)}{\partial\mathbf{r}_{\text{cam}}} = \begin{pmatrix} f_x/z & 0 & -f_x x/z^2 \\ 0 & f_y/z & -f_y y/z^2 \end{pmatrix}\end{split}\]- Parameters:
- cameraCamera
The camera supplying the calibration matrix.
- point_cameranumpy.ndarray
(3,)vector from the camera to the point, in the camera frame.
- Returns:
- numpy.ndarray
(2, 3)Jacobian, or zeros when the point lies in the focal plane (z == 0) and the projection is undefined.
- static calibration_matrix(camera) → ndarray#
Return the pinhole calibration matrix K of a camera.
Camera.calibration_matrixis stored as the(2, 3)projection block[[fx, 0, cx], [0, fy, cy]]; the homogeneous row is appended here.- Parameters:
- cameraCamera
The camera whose intrinsics are wanted.
- Returns:
- numpy.ndarray
(3, 3)calibration matrix.