Cylinder¶
- class Cylinder(*args, **kwargs)¶
Bases:
ForwardProjection
Class that defines a 3D cylinder in the object frame and allows forward projection of a 3D cylinder in the camera frame and in the 2D image plane by perspective projection. All the parameters must be set in meter.
A 3D cylinder of radius R is defined by the set of circles of radius R whose center belongs to a straight line perpendicular to the plane of the circles.
A 3D cylinder has the followings parameters:
in the object frame : the cylinder is represented by the equation: \((X - oX)^2 + (Y - oY)^2 + (Z - oZ)^2 - (oA \; X + oB \; Y + oC \; Z)^2 - R^2 = 0\) with
\[\begin{split}\left\{ \begin{array}{l} oA^2 + oB^2 + oC^2 = 1 \\oA \; oX + oB \; oY + oC \; oZ = 0 \end{array} \right. \end{split}\]
where R is the radius of the cylinder, oA, oB, oC are the coordinates of its direction vector and oX, oY, oZ are the coordinates of the nearest point belonging to the cylinder axis from the projection center. The corresponding parameters are located in vpForwardProjection::oP 7-dim internal vector. They correspond to oP = (oA, oB, oC, oX, oY, oZ, R). Setting the cylinder parameters is achieved through the constructors with parameters or setWorldCoordinates() methods. To get theses parameters use get_oP() .
in the camera frame : parameters are saved in vpTracker::cP 7-dim internal vector with cP =(cA, cB, cC, cX, cY, cZ, R). Considering the set of parameters oP expressed in the object frame, cylinder coordinates expressed in the camera frame are obtained using changeFrame() . To get these parameters use get_cP() .
in the 2D image plane : parameters are saved in vpTracker::p 4-dim vector. They correspond to p = ( \(\rho_1\) , \(\theta_1\) , \(\rho_2\) , \(\theta_2\) ), noting that for non-degenerated cases, the perspective projection of a cylinder on the image plane is a set of two straight lines with equation:
\[\begin{split}\left\{ \begin{array}{lll} x \;\cos\theta_1 + x \;\sin\theta_1 - \rho_1 = 0 \\y \;\cos\theta_2 + y \;\sin\theta_2 - \rho_2 = 0 \end{array} \right. \end{split}\]
Perspective projection is achieved using projection() methods. The methods get_p() , getRho1() , getTheta1() and getRho2() , getTheta2() allow to access to the projected line parameters.
Overloaded function.
__init__(self: visp._visp.core.Cylinder) -> None
Default constructor.
__init__(self: visp._visp.core.Cylinder, oP: visp._visp.core.ColVector) -> None
__init__(self: visp._visp.core.Cylinder, oA: float, oB: float, oC: float, oX: float, oY: float, oZ: float, R: float) -> None
Create and initialize a cylinder with parameters oP = (oA, oB, oC, oX, oY, oZ, R) expressed in the object frame.
Note
See setWorldCoordinates (const double,const double,const double,const double,const double,const double,const double)
- Parameters:
- oA
Cylinder parameters expressed in the object frame.
- oB
Cylinder parameters expressed in the object frame.
- oC
Cylinder parameters expressed in the object frame.
- oX
Cylinder parameters expressed in the object frame.
- oY
Cylinder parameters expressed in the object frame.
- oZ
Cylinder parameters expressed in the object frame.
- R
Cylinder parameters expressed in the object frame.
Methods
Overloaded function.
Overloaded function.
Compute the Z coordinate for the given normalized coordinate in the camera frame.
Overloaded function.
Return cylinder cA parameter expressed in the camera frame.
Return cylinder cB parameter expressed in the camera frame.
Return cylinder cC parameter expressed in the camera frame.
Return cylinder R parameter corresponding to the cylinder radius.
Return the \(\rho_1\) parameter of the line corresponding to the projection of the cylinder in the image plane.
Return the \(\rho_2\) parameter of the line corresponding to the projection of the cylinder in the image plane.
Return the \(\theta_1\) parameter of the line corresponding to the projection of the cylinder in the image plane.
Return the \(\theta_2\) parameter of the line corresponding to the projection of the cylinder in the image plane.
Return cylinder cX parameter expressed in the camera frame.
Return cylinder cY parameter expressed in the camera frame.
Return cylinder cZ parameter expressed in the camera frame.
Default initialisation of the feature parameters:
Overloaded function.
Overloaded function.
Inherited Methods
cP
user
Return object parameters expressed in the 3D camera frame.
oP
Used for memory issue especially in the vpServo class.
Track the feature parameters in the camera frame ( vpTracker::cP ) and than compute the projection of these parameters in the image plane ( vpTracker::p ).
Return object parameters expressed in the 3D object frame.
Overloaded function.
Print to stdout the feature parameters in:
Return object parameters expressed in the 2D image plane computed by perspective projection.
cPAvailable
p
vpDisplayForwardProjection
Operators
__doc__
Overloaded function.
__module__
Attributes
__annotations__
cP
cPAvailable
line1
line2
oP
p
user
vpDisplayForwardProjection
- class ForwardProjectionDeallocatorType(self, value: int)¶
Bases:
pybind11_object
Used for memory issue especially in the vpServo class.
Values:
user
vpDisplayForwardProjection
- class LineCylinderType(self, value: int)¶
Bases:
pybind11_object
Values:
line1: First limb of the cylinder.
line2: Second limb of the cylinder.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: visp._visp.core.Cylinder) -> None
Default constructor.
__init__(self: visp._visp.core.Cylinder, oP: visp._visp.core.ColVector) -> None
__init__(self: visp._visp.core.Cylinder, oA: float, oB: float, oC: float, oX: float, oY: float, oZ: float, R: float) -> None
Create and initialize a cylinder with parameters oP = (oA, oB, oC, oX, oY, oZ, R) expressed in the object frame.
Note
See setWorldCoordinates (const double,const double,const double,const double,const double,const double,const double)
- Parameters:
- oA
Cylinder parameters expressed in the object frame.
- oB
Cylinder parameters expressed in the object frame.
- oC
Cylinder parameters expressed in the object frame.
- oX
Cylinder parameters expressed in the object frame.
- oY
Cylinder parameters expressed in the object frame.
- oZ
Cylinder parameters expressed in the object frame.
- R
Cylinder parameters expressed in the object frame.
- changeFrame(*args, **kwargs)¶
Overloaded function.
changeFrame(self: visp._visp.core.Cylinder, cMo: visp._visp.core.HomogeneousMatrix, cP: visp._visp.core.ColVector) -> None
From the cylinder parameters oP expressed in the object frame, compute the cylinder parameters cP expressed in the camera frame.
Note
See changeFrame(const vpHomogeneousMatrix &)
- Parameters:
- cMo
Camera to object frame transformation.
changeFrame(self: visp._visp.core.Cylinder, cMo: visp._visp.core.HomogeneousMatrix) -> None
From the cylinder oP parameters expressed in the object frame, compute the cylinder internal parameters cP expressed in the camera frame.
Note
See changeFrame(const vpHomogeneousMatrix &, vpColVector &) const
- Parameters:
- cMo
Camera to object frame transformation.
- computeZ(self, x: float, y: float) float ¶
Compute the Z coordinate for the given normalized coordinate in the camera frame.
- display(*args, **kwargs)¶
Overloaded function.
display(self: visp._visp.core.Cylinder, 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 cylinder in image I as two lines corresponding to the limbs.
- Parameters:
- I
Image used as background.
- cam
Camera parameters.
- color
Color used to draw the point.
- thickness
Thickness used to draw the point.
display(self: visp._visp.core.Cylinder, 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 cylinder in image I as two lines corresponding to the limbs.
- Parameters:
- I
Image used as background.
- cam
Camera parameters.
- color
Color used to draw the point.
- thickness
Thickness used to draw the point.
display(self: visp._visp.core.Cylinder, 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 cylinder in image I as two lines corresponding to the limbs. This method is non destructive wrt. cP and p internal 3D point parameters.
- Parameters:
- I
Image used as background.
- cMo
Homogeneous transformation from camera frame to object frame. The point 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.Cylinder, 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 cylinder in image I as two lines corresponding to the limbs. This method is non destructive wrt. cP and p internal 3D point parameters.
- Parameters:
- I
Image used as background.
- cMo
Homogeneous transformation from camera frame to object frame. The point 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._visp.core.ForwardProjection.ForwardProjectionDeallocatorType ¶
- getRho1(self) float ¶
Return the \(\rho_1\) parameter of the line corresponding to the projection of the cylinder in the image plane.
Note
See getTheta1()
- getRho2(self) float ¶
Return the \(\rho_2\) parameter of the line corresponding to the projection of the cylinder in the image plane.
Note
See getTheta2()
- getTheta1(self) float ¶
Return the \(\theta_1\) parameter of the line corresponding to the projection of the cylinder in the image plane.
Note
See getRho1()
- getTheta2(self) float ¶
Return the \(\theta_2\) parameter of the line corresponding to the projection of the cylinder in the image plane.
Note
See getRho2()
- get_cP(self) visp._visp.core.ColVector ¶
Return object parameters expressed in the 3D camera frame.
- get_oP(self) visp._visp.core.ColVector ¶
Return object parameters expressed in the 3D object frame.
- get_p(self) visp._visp.core.ColVector ¶
Return object parameters expressed in the 2D image plane computed by perspective projection.
- init(self) None ¶
Default initialisation of the feature parameters:
in the object frame: oP
in the camera frame: cP
in the image plane: p .
- 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.Cylinder) -> None
Perspective projection of the cylinder.
From the parameters of the cylinder in the camera frame, compute the perspective projection of the cylinder in the image plane.
vpCylinder cylinder; vpColVector oP(7); double oA, oB, oC, oX, oY, oZ, R; ... vpColVector oP({oA, oB, oC, oX, oY, oZ, R}); cylinder.setWorldCoordinates(oP); // Set the cylinder world frame parameters vpHomogeneousMatrix cMo; // Camera to world frame transformation ... cylinder.changeFrame(cMo); // Update internal cP parameters cylinder.projection(); // Compute the perspective projection
Note
See projection(const vpColVector &, vpColVector &)
projection(self: visp._visp.core.Cylinder, cP: visp._visp.core.ColVector, p: visp._visp.core.ColVector) -> None
Perspective projection of the cylinder.
From the parameters of the cylinder in the camera frame \(c{\bf P}\) , compute the perspective projection of the cylinder in the image plane.
vpCylinder cylinder; vpColVector oP(7); // Initialize oP[] with A,B,C,X0,X0,Z0,R parameters cylinder.setWorldCoordinates(oP); // Set the cylinder world frame parameters vpHomogeneousMatrix cMo; // Camera to world frame transformation vpColVector cP(7); // Parameters of the cylinder in the camera frame cylinder.changeFrame(cMo, cP); // Update cP parameters vpColVector p(4); // Parameters of the cylinder in the image plane cylinder.projection(cP, p); // Compute the perspective projection and update p
Note
See projection()
- setDeallocate(self, d: visp._visp.core.ForwardProjection.ForwardProjectionDeallocatorType) None ¶
- setWorldCoordinates(*args, **kwargs)¶
Overloaded function.
setWorldCoordinates(self: visp._visp.core.Cylinder, oP: visp._visp.core.ColVector) -> None
Set the cylinder parameters \(^{o}{\bf P} = ({^o}A,{^o}B,{^o}C,{^o}X_0,{^o}Y_0,{^o}Z_0,R)\) expressed in the world frame.
vpCylinder cylinder; double oA, oB, oC, oX, oY, oZ, R; ... vpColVector oP({oA, oB, oC, oX, oY, oZ, R}); cylinder.setWorldCoordinates(oP);
setWorldCoordinates(self: visp._visp.core.Cylinder, oA: float, oB: float, oC: float, oX: float, oY: float, oZ: float, R: float) -> None
Set the cylinder parameters oP = (oA, oB, oC, oX, oY, oZ, R) expressed in the object frame.
- Parameters:
- oA
Cylinder parameters in the object frame.
- oB
Cylinder parameters in the object frame.
- oC
Cylinder parameters in the object frame.
- oX
Cylinder parameters in the object frame.
- oY
Cylinder parameters in the object frame.
- oZ
Cylinder parameters in the object frame.
- R
Cylinder parameters in the object frame.
- track(self, cMo: visp._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._visp.core.HomogeneousMatrix¶
The homogeneous matrix corresponding to the pose between the camera frame and the object frame.