Circle¶
- class Circle(*args, **kwargs)¶
Bases:
ForwardProjection
Class that defines a 3D circle in the object frame and allows forward projection of a 3D circle in the camera frame and in the 2D image plane by perspective projection. All the parameters must be set in meter.
Note that a 3D circle is defined from the intersection between a 3D plane and a 3D sphere.
A 3D circle has the followings parameters:
in the object frame : the parameters oA, oB, oC corresponding to the 3D plane with equation oA*(X-oX)+oB*(Y-oY)+oC*(Z-oZ)=0 where (X,Y,Z) are the coordinates of a 3D point belonging to the plane passing through the 3D sphere center (oX,oY,oZ) and the 3D coordinates oX, oY, oZ of the center and radius R of the 3D sphere. These parameters registered in vpForwardProjection::oP internal 7-dim vector are set using the constructors vpCircle(double oA, double oB, double oC, double oX, double oY, double oZ, double R) , vpCircle(const vpColVector &oP) or the functions setWorldCoordinates(double oA, double oB, double oC, 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 parameters cA, cB, cC corresponding to the 3D plane cAx+cBy+cCz+D=0 and the coordinates cX, cY, cZ of the center and radius R of the 3D sphere. These parameters registered in vpTracker::cP internal 7-dim vector are computed using changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const or changeFrame(const vpHomogeneousMatrix &cMo) . These parameters could be retrieved using getA() , getB() , getC() , 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 circle. 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 circle parameters with values expressed in meters. To get theses parameters use get_p() .
Overloaded function.
__init__(self: visp._visp.core.Circle) -> None
Default constructor that initialize internal vectors.
__init__(self: visp._visp.core.Circle, oP: visp._visp.core.ColVector) -> None
__init__(self: visp._visp.core.Circle, oA: float, oB: float, oC: float, oX: float, oY: float, oZ: float, R: float) -> None
Construct the 3D circle from the intersection of a plane and a sphere with coordinates expressed in the object frame.
Note
See setWorldCoordinates()
- Parameters:
- oA
Parameters of the plane with equation oA*(X-oX)+oB*(Y-oY)+oC*(Z-oZ)=0 passing through the 3D sphere center.
- oB
Parameters of the plane with equation oA*(X-oX)+oB*(Y-oY)+oC*(Z-oZ)=0 passing through the 3D sphere center.
- oC
Parameters of the plane with equation oA*(X-oX)+oB*(Y-oY)+oC*(Z-oZ)=0 passing through the 3D sphere center.
- oX
Coordinate of the center of the sphere along X-axis in the object frame.
- oY
Coordinate of the center of the sphere along Y-axis in the object frame.
- oZ
Coordinate of the center of the sphere along Z-axis in the object frame.
- R
Radius of the sphere.
Methods
Overloaded function.
Overloaded function.
Computes the coordinates of the point corresponding to the intersection between a circle and a line.
Overloaded function.
Overloaded function.
Overloaded function.
Inherited Methods
vpDisplayForwardProjection
cP
Return object parameters expressed in the 2D image plane computed by perspective projection.
Overloaded function.
cPAvailable
oP
user
Used for memory issue especially in the vpServo class.
p
Return object parameters expressed in the 3D camera frame.
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.
Print to stdout the feature parameters in:
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.Circle) -> None
Default constructor that initialize internal vectors.
__init__(self: visp._visp.core.Circle, oP: visp._visp.core.ColVector) -> None
__init__(self: visp._visp.core.Circle, oA: float, oB: float, oC: float, oX: float, oY: float, oZ: float, R: float) -> None
Construct the 3D circle from the intersection of a plane and a sphere with coordinates expressed in the object frame.
Note
See setWorldCoordinates()
- Parameters:
- oA
Parameters of the plane with equation oA*(X-oX)+oB*(Y-oY)+oC*(Z-oZ)=0 passing through the 3D sphere center.
- oB
Parameters of the plane with equation oA*(X-oX)+oB*(Y-oY)+oC*(Z-oZ)=0 passing through the 3D sphere center.
- oC
Parameters of the plane with equation oA*(X-oX)+oB*(Y-oY)+oC*(Z-oZ)=0 passing through the 3D sphere center.
- oX
Coordinate of the center of the sphere along X-axis in the object frame.
- oY
Coordinate of the center of the sphere along Y-axis in the object frame.
- oZ
Coordinate of the center of the sphere along Z-axis in the object frame.
- R
Radius of the sphere.
- changeFrame(*args, **kwargs)¶
Overloaded function.
changeFrame(self: visp._visp.core.Circle, noMo: visp._visp.core.HomogeneousMatrix, noP: visp._visp.core.ColVector) -> None
From the 3D coordinates of the circle in the object frame oP that are set using for example vpCircle(double oA, double oB, double oC, double oX, double oY, double oZ, double R) or setWorldCoordinates() , compute the 3D coordinates of the circle in a new object frame noP = noMo * oP. Internal parameters of the circle remain unchanged.
- Parameters:
- noMo
Transformation from camera to object frame.
- noP
3D normalized coordinates of the circle in the a new ojbect frame noP = (noA, noB, noC, noX, noY, noZ, R).
changeFrame(self: visp._visp.core.Circle, cMo: visp._visp.core.HomogeneousMatrix) -> None
Perspective projection of the circle. Internal circle parameters are modified in cP.
- Parameters:
- cMo
Homogeneous transformation from camera frame to object frame.
- static computeIntersectionPoint(circle: visp._visp.core.Circle, cam: visp._visp.core.CameraParameters, rho: float, theta: float) tuple[float, float] ¶
Computes the coordinates of the point corresponding to the intersection between a circle and a line.
Warning
This functions assumes changeFrame() and projection() have already been called.
Note
See changeFrame() , projection()
- Parameters:
- circle: visp._visp.core.Circle¶
Circle to consider for the intersection.
- cam: visp._visp.core.CameraParameters¶
Camera parameters that have to be used for the intersection computation.
- rho: float¶
The rho parameter of the line.
- theta: float¶
The theta parameter of the line.
- Returns:
A tuple containing:
i: resulting i-coordinate of the intersection point.
j: resulting j-coordinate of the intersection point.
- display(*args, **kwargs)¶
Overloaded function.
display(self: visp._visp.core.Circle, 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 circle in image I using internal coordinates in the image plane (x,y,n20,n11,n02) available in p vector. These coordinates may be updated using projection() .
- Parameters:
- I
Image used as background.
- cam
Camera parameters.
- color
Color used to draw the circle.
- thickness
Thickness used to draw the circle.
display(self: visp._visp.core.Circle, 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 sphere in image I . This method is non destructive wrt. cP and p internal circle parameters.
- Parameters:
- I
Image used as background.
- cMo
Homogeneous transformation from camera frame to object frame. The circle is considered as viewed from this camera position.
- cam
Camera parameters.
- color
Color used to draw the sphere.
- thickness
Thickness used to draw the circle.
display(self: visp._visp.core.Circle, 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 circle in image I using internal coordinates in the image plane (x,y,n20,n11,n02) available in p vector. These coordinates may be updated using projection() .
- Parameters:
- I
Image used as background.
- cam
Camera parameters.
- color
Color used to draw the circle.
- thickness
Thickness used to draw the circle.
display(self: visp._visp.core.Circle, 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 sphere in image I . This method is non destructive wrt. cP and p internal circle parameters.
- Parameters:
- I
Image used as background.
- cMo
Homogeneous transformation from camera frame to object frame. The circle is considered as viewed from this camera position.
- cam
Camera parameters.
- color
Color used to draw the sphere.
- thickness
Thickness used to draw the circle.
- getDeallocate(self) visp._visp.core.ForwardProjection.ForwardProjectionDeallocatorType ¶
- 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.
- 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.Circle) -> None
Perspective projection of the circle.
From the 3D parameters of the circle in the camera frame available in cP, computes the 2D parameters of the ellipse resulting from the perspective projection in the image plane. Those 2D parameters are available in p vector.
See vpCircle::projection(const vpColVector &, vpColVector &) const for a more detailed description of the parameters.
projection(self: visp._visp.core.Circle, cP: visp._visp.core.ColVector, p: visp._visp.core.ColVector) -> None
Perspective projection of the circle.
- setDeallocate(self, d: visp._visp.core.ForwardProjection.ForwardProjectionDeallocatorType) None ¶
- setWorldCoordinates(*args, **kwargs)¶
Overloaded function.
setWorldCoordinates(self: visp._visp.core.Circle, oP: visp._visp.core.ColVector) -> None
Set the parameters of the 3D circle in the object frame.
setWorldCoordinates(self: visp._visp.core.Circle, oA: float, oB: float, oC: float, oX: float, oY: float, oZ: float, R: float) -> None
Set the 3D circle coordinates in the object frame.
- Parameters:
- oA
Parameters of the plane with equation oA*(X-oX)+oB*(Y-oY)+oC*(Z-oZ)=0 passing through the 3D sphere center.
- oB
Parameters of the plane with equation oA*(X-oX)+oB*(Y-oY)+oC*(Z-oZ)=0 passing through the 3D sphere center.
- oC
Parameters of the plane with equation oA*(X-oX)+oB*(Y-oY)+oC*(Z-oZ)=0 passing through the 3D sphere center.
- oX
Coordinate of the center of the sphere along X-axis in the object frame.
- oY
Coordinate of the center of the sphere along Y-axis in the object frame.
- oZ
Coordinate of the center of the sphere along Z-axis in the object frame.
- R
Radius of the sphere.
- 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.