CentralCamera.project_point#

CentralCamera.project_point(P: ndarray | float | int | list[float | int] | tuple[float | int, ...], pose: SE3 | None = None, objpose: SE3 | None = None, behind: bool = True, visibility: bool = False, retinal: bool = False, **kwargs) ndarray[source]#

Project 3D points to image plane

Parameters:
  • P (array_like(3), array_like(3,n), array_like(4), array_like(4,n)) – 3D world point or points in Euclidean or homogeneous form

  • pose (SE3, optional) – camera pose with respect to the world frame, defaults to camera’s pose attribute

  • objpose (SE3, optional) – 3D point reference frame, defaults to world frame

  • behind (bool, optional) – points behind the camera indicated by NaN, defaults to True

  • visibility (bool) – return visibility array, defaults to False

  • retinal (bool, optional) – transform to retinal coordinates, defaults to False

Returns:

image plane points, optional visibility vector

Return type:

ndarray(2,n), ndarray(n)

Project a 3D point to the image plane

\[\hvec{p} = \mat{C} \hvec{P}\]

where \(\mat{C}\) is the camera calibration matrix and \(\hvec{p}\) and \(\hvec{P}\) are the image plane and world frame coordinates respectively, in homogeneous form.

World points are given as a 1D array or the columns of a 2D array of Euclidean or homogeneous coordinates. The computed image plane coordinates are Euclidean or homogeneous and given as a 1D array or the corresponding columns of a 2D array.

If pose is specified it is used for the camera frame pose, otherwise the attribute pose is used. The object’s pose attribute is not updated if pose is specified.

A single point can be specified as a 3-vector, multiple points as an array with three rows and each column is the 3D point coordinate (X, Y, Z).

The points P are by default with respect to the world frame, but they can be transformed by specifying objpose.

If world points are behind the camera and behind is True then the image plane coordinates are set to NaN.

If visibility is True then each projected point is checked to ensure it lies in the bounds of the image plane. In this case there are two return values: the image plane coordinates and an array of booleans indicating if the corresponding point is visible.

If retinal is True then project points in retinal coordinates, in units of metres with respect to the principal point.

Example:

>>> from machinevisiontoolbox import CentralCamera
>>> camera = CentralCamera.Default()
>>> camera.project_point((0.3, 0.4, 2))
array([[620.],
       [660.]])
References:
Seealso:

C project_point project_line project_quadric