Sphere¶
- class Sphere(*args, **kwargs)¶
Bases:
ForwardProjection
Class that defines a 3D sphere in the object frame and allows forward projection of a 3D sphere in the camera frame and in the 2D image plane by perspective projection. All the parameters must be set in meter.
A sphere has the followings parameters:
in the object frame : the 3D coordinates oX, oY, oZ of the center and radius R. These parameters registered in vpForwardProjection::oP internal 4-dim vector are set using the constructors vpSphere (double oX, double oY, double oZ, double R), vpSphere(const vpColVector &oP) or the functions setWorldCoordinates(double oX, double oY, double oZ, double R) and setWorldCoordinates(const vpColVector &oP) . To get theses parameters use get_oP() .
in the camera frame : the coordinates cX, cY, cZ of the center and radius R. These parameters registered in vpTracker::cP internal 4-dim vector are computed using changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const or changeFrame(const vpHomogeneousMatrix &cMo) . These parameters could be retrieved using getX() , getY() , getZ() and getR() . To get theses parameters use get_cP() .
in the image plane : here we consider the parameters of the ellipse corresponding to the perspective projection of the 3D sphere. The parameters are the ellipse centroid (x, y) and n20, n11, n02 which are the second order centered moments of the ellipse normalized by its area (i.e., such that \(n_{ij} = \mu_{ij}/a\) where \(\mu_{ij}\) are the centered moments and a the area). These parameters are registered in vpTracker::p internal 5-dim vector and computed using projection() and projection(const vpColVector &cP, vpColVector &p) const . They could be retrieved using get_x() , get_y() , get_n20() , get_n11() and get_n02() . They correspond to 2D normalized sphere parameters with values expressed in meters. To get theses parameters use get_p() .
Overloaded function.
__init__(self: visp._visp.core.Sphere) -> None
Default constructor.
__init__(self: visp._visp.core.Sphere, oP: visp._visp.core.ColVector) -> None
__init__(self: visp._visp.core.Sphere, oX: float, oY: float, oZ: float, R: float) -> None
Create a sphere from the 3D coordinates of its center and its radius. The 3D coordinates of the center are defined in the sphere frame.
- Parameters:
- oX
3D coordinate of the sphere center along X axis in [m].
- oY
3D coordinate of the sphere center along X axis in [m].
- oZ
3D coordinate of the sphere center along X axis in [m].
- R
Sphere radius in [m].
Methods
Overloaded function.
Overloaded function.
Overloaded function.
Overloaded function.
Overloaded function.
Inherited Methods
Return object parameters expressed in the 2D image plane computed by perspective projection.
cPAvailable
p
Return object parameters expressed in the 3D camera frame.
Print to stdout the feature parameters in:
Track the feature parameters in the camera frame ( vpTracker::cP ) and than compute the projection of these parameters in the image plane ( vpTracker::p ).
Used for memory issue especially in the vpServo class.
user
oP
Overloaded function.
cP
vpDisplayForwardProjection
Return object parameters expressed in the 3D object frame.
Operators
__doc__
Overloaded function.
__module__
Attributes
__annotations__
cP
cPAvailable
oP
p
user
vpDisplayForwardProjection
- class ForwardProjectionDeallocatorType(self, value: int)¶
Bases:
pybind11_object
Used for memory issue especially in the vpServo class.
Values:
user
vpDisplayForwardProjection
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: visp._visp.core.Sphere) -> None
Default constructor.
__init__(self: visp._visp.core.Sphere, oP: visp._visp.core.ColVector) -> None
__init__(self: visp._visp.core.Sphere, oX: float, oY: float, oZ: float, R: float) -> None
Create a sphere from the 3D coordinates of its center and its radius. The 3D coordinates of the center are defined in the sphere frame.
- Parameters:
- oX
3D coordinate of the sphere center along X axis in [m].
- oY
3D coordinate of the sphere center along X axis in [m].
- oZ
3D coordinate of the sphere center along X axis in [m].
- R
Sphere radius in [m].
- changeFrame(*args, **kwargs)¶
Overloaded function.
changeFrame(self: visp._visp.core.Sphere, cMo: visp._visp.core.HomogeneousMatrix, cP: visp._visp.core.ColVector) -> None
Perspective projection of the sphere. This method doesn’t modify internal sphere parameters cP.
- Parameters:
- cMo
Homogeneous transformation from camera frame to sphere frame.
changeFrame(self: visp._visp.core.Sphere, cMo: visp._visp.core.HomogeneousMatrix) -> None
Perspective projection of the sphere. Internal sphere parameters are modified in cP.
- Parameters:
- cMo
Homogeneous transformation from camera frame to object frame.
- display(*args, **kwargs)¶
Overloaded function.
display(self: visp._visp.core.Sphere, I: visp._visp.core.ImageGray, cam: visp._visp.core.CameraParameters, color: visp._visp.core.Color = vpColor::green, thickness: int = 1) -> None
Display the projection of a 3D sphere in image I .
- Parameters:
- I
Image used as background.
- cam
Camera parameters.
- color
Color used to draw the sphere.
- thickness
Thickness used to draw the sphere.
display(self: visp._visp.core.Sphere, I: visp._visp.core.ImageGray, cMo: visp._visp.core.HomogeneousMatrix, cam: visp._visp.core.CameraParameters, color: visp._visp.core.Color = vpColor::green, thickness: int = 1) -> None
Display the projection of a 3D sphere in image I . This method is non destructive wrt. cP and p internal sphere parameters.
- Parameters:
- I
Image used as background.
- cMo
Homogeneous transformation from camera frame to object frame. The sphere is considered as viewed from this camera position.
- cam
Camera parameters.
- color
Color used to draw the sphere.
- thickness
Thickness used to draw the sphere.
display(self: visp._visp.core.Sphere, I: visp._visp.core.ImageRGBa, cam: visp._visp.core.CameraParameters, color: visp._visp.core.Color = vpColor::green, thickness: int = 1) -> None
Display the projection of a 3D sphere in image I .
- Parameters:
- I
Image used as background.
- cam
Camera parameters.
- color
Color used to draw the sphere.
- thickness
Thickness used to draw the sphere.
display(self: visp._visp.core.Sphere, I: visp._visp.core.ImageRGBa, cMo: visp._visp.core.HomogeneousMatrix, cam: visp._visp.core.CameraParameters, color: visp._visp.core.Color = vpColor::green, thickness: int = 1) -> None
Display the projection of a 3D sphere in image I . This method is non destructive wrt. cP and p internal sphere parameters.
- Parameters:
- I
Image used as background.
- cMo
Homogeneous transformation from camera frame to object frame. The sphere is considered as viewed from this camera position.
- cam
Camera parameters.
- color
Color used to draw the sphere.
- thickness
Thickness used to draw the sphere.
- getDeallocate(self) visp.core.ForwardProjection.ForwardProjectionDeallocatorType ¶
- get_cP(self) visp.core.ColVector ¶
Return object parameters expressed in the 3D camera frame.
- get_oP(self) visp.core.ColVector ¶
Return object parameters expressed in the 3D object frame.
- get_p(self) visp.core.ColVector ¶
Return object parameters expressed in the 2D image plane computed by perspective projection.
- print(self) None ¶
Print to stdout the feature parameters in:
the object frame
the camera frame
the image plane.
- project(*args, **kwargs)¶
Overloaded function.
project(self: visp._visp.core.ForwardProjection) -> None
Compute the feature parameters in the image plane ( vpTracker::p ) from the parameters in the camera frame ( vpTracker::cP ).
Warning
Be careful to update vpTracker::p and vpTracker::cP public attributes before the call of this method.
project(self: visp._visp.core.ForwardProjection, cMo: visp._visp.core.HomogeneousMatrix) -> None
Compute the feature parameters in the camera frame ( vpTracker::cP ) and than compute the projection of these parameters in the image plane ( vpTracker::p ).
Warning
The feature parameters in the object frame ( vpForwardProjection :oP) need to be set prior the use of this method. To initialize these parameters see setWorldCoordinates() .
- Parameters:
- cMo
The homogeneous matrix corresponding to the pose between the camera frame and the object frame.
- projection(*args, **kwargs)¶
Overloaded function.
projection(self: visp._visp.core.Sphere) -> None
Perspective projection of the sphere. This method updates internal parameters (cP and p).
See vpSphere::projection(const vpColVector &, vpColVector &) const for a more detailed description of the parameters.
projection(self: visp._visp.core.Sphere, cP: visp._visp.core.ColVector, p: visp._visp.core.ColVector) -> None
Perspective projection of the sphere. Internal parameters (cP and p) are not modified.
- setDeallocate(self, d: visp.core.ForwardProjection.ForwardProjectionDeallocatorType) None ¶
- setWorldCoordinates(*args, **kwargs)¶
Overloaded function.
setWorldCoordinates(self: visp._visp.core.Sphere, oP: visp._visp.core.ColVector) -> None
Set sphere 3D parameters from a 4-dim vector that contains 3D coordinates of its center and its radius. The 3D coordinates of the center are defined in the sphere frame.
setWorldCoordinates(self: visp._visp.core.Sphere, oX: float, oY: float, oZ: float, R: float) -> None
Set sphere 3D parameters from the 3D coordinates of its center and its radius. The 3D coordinates of the center are defined in the sphere frame.
- Parameters:
- oX
3D coordinate of the sphere center along X axis in [m].
- oY
3D coordinate of the sphere center along X axis in [m].
- oZ
3D coordinate of the sphere center along X axis in [m].
- R
Sphere radius in [m].
- track(self, cMo: visp.core.HomogeneousMatrix) None ¶
Track the feature parameters in the camera frame ( vpTracker::cP ) and than compute the projection of these parameters in the image plane ( vpTracker::p ).
This method is similar to project(const vpHomogeneousMatrix &) .
Warning
The feature parameters in the object frame ( vpForwardProjection :oP) need to be set prior the use of this method. To initialize these parameters see setWorldCoordinates() .
- Parameters:
- cMo: visp.core.HomogeneousMatrix¶
The homogeneous matrix corresponding to the pose between the camera frame and the object frame.