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’sposeattributeobjpose (
SE3, optional) – 3D point reference frame, defaults to world framebehind (bool, optional) – points behind the camera indicated by NaN, defaults to
Truevisibility (bool) – return visibility array, defaults to
Falseretinal (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
poseis specified it is used for the camera frame pose, otherwise the attributeposeis used. The object’sposeattribute is not updated ifposeis 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
Pare by default with respect to the world frame, but they can be transformed by specifyingobjpose.If world points are behind the camera and
behindisTruethen the image plane coordinates are set to NaN.If
visibilityisTruethen 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
retinalisTruethen 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: