Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
vpCircle Class Reference

#include <visp3/core/vpCircle.h>

+ Inheritance diagram for vpCircle:

Public Types

enum  vpForwardProjectionDeallocatorType { user, vpDisplayForwardProjection }
 

Public Member Functions

void init ()
 
 vpCircle ()
 
 vpCircle (const vpColVector &oP)
 
 vpCircle (const double A, const double B, const double C, const double X0, const double Y0, const double Z0, const double R)
 
virtual ~vpCircle ()
 
void setWorldCoordinates (const vpColVector &oP)
 
void setWorldCoordinates (const double A, const double B, const double C, const double X0, const double Y0, const double Z0, const double R)
 
double getA () const
 
double getB () const
 
double getC () const
 
double getX () const
 
double getY () const
 
double getZ () const
 
double getR () const
 
void projection ()
 
void projection (const vpColVector &cP, vpColVector &p)
 
void changeFrame (const vpHomogeneousMatrix &cMo, vpColVector &cP)
 
void changeFrame (const vpHomogeneousMatrix &cMo)
 
void display (const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpColor &color=vpColor::green, const unsigned int thickness=1)
 
void display (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &color=vpColor::green, const unsigned int thickness=1)
 
vpCircleduplicate () const
 
void project ()
 
void project (const vpHomogeneousMatrix &cMo)
 
void track (const vpHomogeneousMatrix &cMo)
 
virtual void print () const
 
void setDeallocate (vpForwardProjectionDeallocatorType d)
 
vpForwardProjectionDeallocatorType getDeallocate ()
 

Static Public Member Functions

static void computeIntersectionPoint (const vpCircle &circle, const vpCameraParameters &cam, const double &rho, const double &theta, double &i, double &j)
 

Public Attributes

vpColVector oP
 
vpColVector p
 
vpColVector cP
 
bool cPAvailable
 

Detailed Description

Member Enumeration Documentation

Used for memory issue especially in the vpServo class.

Enumerator
user 
vpDisplayForwardProjection 

Definition at line 211 of file vpForwardProjection.h.

Constructor & Destructor Documentation

vpCircle::vpCircle ( )

Definition at line 87 of file vpCircle.cpp.

References init().

Referenced by duplicate().

vpCircle::vpCircle ( const vpColVector oP_)
explicit

Construct the circle from the intersection of a plane and a sphere.

Parameters
oP_: oP[0], oP[1], oP[2] correspond to A, B, C from the plane equation Ax + By + Cz = 0. oP[3], oP[4], oP[5] correspond to X, Y, Z the coordinates of the center of the sphere. oP[6] corresponds to the radius of the sphere.
See also
setWorldCoordinates()

Definition at line 99 of file vpCircle.cpp.

References init(), and setWorldCoordinates().

vpCircle::vpCircle ( const double  A,
const double  B,
const double  C,
const double  X0,
const double  Y0,
const double  Z0,
const double  R 
)

Construct the circle from the intersection of a plane and a sphere.

Parameters
A: A from the plane equation Ax + By + Cz = 0.
B: B from the plane equation Ax + By + Cz = 0.
C: C from the plane equation Ax + By + Cz = 0.
X0: X Coordinate of the center of the sphere.
Y0: Y Coordinate of the center of the sphere.
Z0: Z Coordinate of the center of the sphere.
R: Radius of the sphere.
See also
setWorldCoordinates()

Definition at line 118 of file vpCircle.cpp.

References init(), and setWorldCoordinates().

vpCircle::~vpCircle ( )
virtual

Definition at line 125 of file vpCircle.cpp.

Member Function Documentation

void vpCircle::changeFrame ( const vpHomogeneousMatrix cMo)
virtual

perspective projection of the circle

Implements vpForwardProjection.

Definition at line 267 of file vpCircle.cpp.

References vpTracker::cP, and vpForwardProjection::oP.

void vpCircle::computeIntersectionPoint ( const vpCircle circle,
const vpCameraParameters cam,
const double &  rho,
const double &  theta,
double &  i,
double &  j 
)
static

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.
See also
changeFrame(), projection()
Parameters
circle: Circle to consider for the intersection.
cam: Camera parameters that have to be used for the intersection computation.
rho: The rho parameter of the line.
theta: The theta parameter of the line.
i: resulting i-coordinate of the intersection point.
j: resulting j-coordinate of the intersection point.

Definition at line 332 of file vpCircle.cpp.

References vpCameraParameters::get_px(), vpCameraParameters::get_py(), vpCameraParameters::get_u0(), vpCameraParameters::get_v0(), vpTracker::p, and vpMath::sqr().

Referenced by vpMbtDistanceKltCylinder::display(), vpMbtDistanceCylinder::display(), vpMbtDistanceCylinder::initMovingEdge(), and vpMbtDistanceCylinder::updateMovingEdge().

void vpCircle::display ( const vpImage< unsigned char > &  I,
const vpCameraParameters cam,
const vpColor color = vpColor::green,
const unsigned int  thickness = 1 
)
virtual

Displays the feature in the image I thanks to the 2D feature parameters in the image plane (vpTracker::p) and the camera parameters which enable to convert the features from meter to pixel.

Parameters
I: The image where the feature must be displayed in overlay.
cam: The camera parameters to enable the conversion from meter to pixel.
color: The desired color to display the line in the image.
thickness: Thickness of the feature representation.

Implements vpForwardProjection.

Examples:
manGeometricFeatures.cpp.

Definition at line 294 of file vpCircle.cpp.

References vpFeatureDisplay::displayEllipse(), and vpTracker::p.

void vpCircle::display ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo,
const vpCameraParameters cam,
const vpColor color = vpColor::green,
const unsigned int  thickness = 1 
)
virtual

Displays the feature in the image I thanks to the features in the object frame (vpForwardProjection::oP), the homogeneous matrix relative to the pose between the object frame and the camera frame and the camera parameters which enable to convert the features from meter to pixel.

Parameters
I: The image where the line must be displayed in overlay.
cMo: The homogeneous matrix corresponding to the pose between the camera frame and the object frame.
cam: The camera parameters to enable the conversion from meter to pixel.
color: The desired color to display the line in the image.
thickness: Thickness of the feature representation.

Implements vpForwardProjection.

Definition at line 301 of file vpCircle.cpp.

References changeFrame(), vpFeatureDisplay::displayEllipse(), and projection().

vpCircle * vpCircle::duplicate ( ) const
virtual

for memory issue (used by the vpServo class only)

Implements vpForwardProjection.

Definition at line 310 of file vpCircle.cpp.

References vpCircle().

double vpCircle::getA ( ) const
inline

Definition at line 72 of file vpCircle.h.

double vpCircle::getB ( ) const
inline

Definition at line 73 of file vpCircle.h.

double vpCircle::getC ( ) const
inline

Definition at line 74 of file vpCircle.h.

vpForwardProjectionDeallocatorType vpForwardProjection::getDeallocate ( )
inlineinherited

Definition at line 220 of file vpForwardProjection.h.

double vpCircle::getX ( ) const
inline

Definition at line 76 of file vpCircle.h.

double vpCircle::getY ( ) const
inline

Definition at line 77 of file vpCircle.h.

double vpCircle::getZ ( ) const
inline

Definition at line 78 of file vpCircle.h.

void vpCircle::init ( )
virtual

Default initialisation of the feature parameters:

  • in the object frame: oP
  • in the camera frame: cP
  • in the image plane: p.

Implements vpForwardProjection.

Definition at line 43 of file vpCircle.cpp.

References vpTracker::cP, vpForwardProjection::oP, vpTracker::p, and vpColVector::resize().

Referenced by vpCircle().

void vpForwardProjection::print ( ) const
virtualinherited

Print to stdout the feature parameters in:

  • the object frame
  • the camera frame
  • the image plane.
Examples:
servoSimuCircle2DCamVelocityDisplay.cpp, servoSimuLine2DCamVelocityDisplay.cpp, and servoSimuSquareLine2DCamVelocityDisplay.cpp.

Definition at line 53 of file vpForwardProjection.cpp.

References vpTracker::cP, vpForwardProjection::oP, vpTracker::p, and vpColVector::t().

void vpForwardProjection::project ( const vpHomogeneousMatrix cMo)
inherited

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.

Definition at line 84 of file vpForwardProjection.cpp.

References vpForwardProjection::changeFrame(), vpForwardProjection::projection(), and vpERROR_TRACE.

void vpCircle::projection ( )
virtual

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 &) for a more detailed description of the parameters.

Implements vpForwardProjection.

Definition at line 138 of file vpCircle.cpp.

References vpTracker::cP, and vpTracker::p.

Referenced by vpMbtDistanceCircle::computeInteractionMatrixError(), vpMbtDistanceCylinder::computeInteractionMatrixError(), display(), vpMbtDistanceCircle::display(), vpMbtDistanceKltCylinder::display(), vpMbtDistanceCylinder::display(), vpMbtDistanceCircle::initMovingEdge(), vpMbtDistanceCylinder::initMovingEdge(), vpMbtDistanceCircle::updateMovingEdge(), and vpMbtDistanceCylinder::updateMovingEdge().

void vpCircle::projection ( const vpColVector cP_,
vpColVector p_ 
)
virtual

Perspective projection of the circle.

Parameters
cP_3D cercle input parameters. This vector is of dimension 7. It contains the following parameters: A, B, C, X0, Y0, Z0, r where
  • A,B,C are the parameters of the plane with equation Ax+By+Cz+D=0 containing the circle
  • X0,Y0,Z0 are the 3D coordinates of the cercle in the camera frame
  • r is the circle radius.
p_2D circle output parameters. This is a 5 dimension vector. It contains the following parameters: xc, yc, m20, m11, m02 where:
  • xc,yc are the normalized coordinates of the center of the ellipse (ie the perspective projection of a 3D circle becomes a 2D ellipse in the image) in the image plane.
  • mu20,mu11,mu02 are the second order centered moments of the ellipse.

Implements vpForwardProjection.

Definition at line 156 of file vpCircle.cpp.

References vpException::divideByZeroError, vpMath::sqr(), and vpERROR_TRACE.

void vpForwardProjection::setDeallocate ( vpForwardProjectionDeallocatorType  d)
inlineinherited

Definition at line 219 of file vpForwardProjection.h.

void vpCircle::setWorldCoordinates ( const vpColVector oP_)
virtual

Set the world coordinates of the circle from the intersection of a plane and a sphere. We mean here the coordinates of the circle in the object frame

Parameters
oP_: oP[0], oP[1], oP[2] correspond to A, B, C from the plane equation Ax + By + Cz = 0. oP[3], oP[4], oP[5] correspond to X, Y, Z the coordinates of the center of the sphere. oP[6] corresponds to the radius of the sphere.

Implements vpForwardProjection.

Examples:
manGeometricFeatures.cpp, servoSimuCircle2DCamVelocity.cpp, servoSimuCircle2DCamVelocityDisplay.cpp, simulateCircle2DCamVelocity.cpp, and testPoseFeatures.cpp.

Definition at line 61 of file vpCircle.cpp.

References vpForwardProjection::oP.

Referenced by vpMbtDistanceCircle::buildFrom(), vpMbtDistanceKltCylinder::buildFrom(), vpMbtDistanceCylinder::buildFrom(), and vpCircle().

void vpCircle::setWorldCoordinates ( const double  A,
const double  B,
const double  C,
const double  X0,
const double  Y0,
const double  Z0,
const double  R 
)

Set the world coordinates of the circle from the intersection of a plane and a sphere. We mean here the coordinates of the circle in the object frame

Parameters
A: A from the plane equation Ax + By + Cz = 0.
B: B from the plane equation Ax + By + Cz = 0.
C: C from the plane equation Ax + By + Cz = 0.
X0: X Coordinate of the center of the sphere.
Y0: Y Coordinate of the center of the sphere.
Z0: Z Coordinate of the center of the sphere.
R: Radius of the sphere.

Definition at line 75 of file vpCircle.cpp.

References vpForwardProjection::oP.

void vpForwardProjection::track ( const vpHomogeneousMatrix cMo)
inherited

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: The homogeneous matrix corresponding to the pose between the camera frame and the object frame.
Examples:
mbot-apriltag-ibvs.cpp, servoMomentPoints.cpp, servoMomentPolygon.cpp, servoSimu4Points.cpp, servoSimuAfma6FourPoints2DCamVelocity.cpp, servoSimuCircle2DCamVelocity.cpp, servoSimuCircle2DCamVelocityDisplay.cpp, servoSimuFourPoints2DCamVelocity.cpp, servoSimuFourPoints2DCamVelocityDisplay.cpp, servoSimuFourPoints2DPolarCamVelocityDisplay.cpp, servoSimuLine2DCamVelocityDisplay.cpp, servoSimuSphere.cpp, servoSimuSphere2DCamVelocity.cpp, servoSimuSphere2DCamVelocityDisplay.cpp, servoSimuSphere2DCamVelocityDisplaySecondaryTask.cpp, servoSimuSquareLine2DCamVelocityDisplay.cpp, servoSimuViper850FourPoints2DCamVelocity.cpp, simulateCircle2DCamVelocity.cpp, simulateFourPoints2DCartesianCamVelocity.cpp, simulateFourPoints2DPolarCamVelocity.cpp, tutorial-ibvs-4pts-ogre.cpp, tutorial-ibvs-4pts-plotter-continuous-gain-adaptive.cpp, tutorial-ibvs-4pts-plotter-gain-adaptive.cpp, tutorial-ibvs-4pts-plotter.cpp, tutorial-ibvs-4pts.cpp, tutorial-simu-pioneer-continuous-gain-adaptive.cpp, tutorial-simu-pioneer-continuous-gain-constant.cpp, tutorial-simu-pioneer-pan.cpp, and tutorial-simu-pioneer.cpp.

Definition at line 111 of file vpForwardProjection.cpp.

References vpForwardProjection::project(), and vpERROR_TRACE.

Referenced by vpPoseFeatures::addFeatureSegment(), vpPose::computeResidual(), vpProjectionDisplay::displayCamera(), vpPose::poseVirtualVS(), vpPose::poseVirtualVSrobust(), vpWireFrameSimulator::projectCameraTrajectory(), vpSimulatorAfma6::updateArticularPosition(), and vpSimulatorViper850::updateArticularPosition().

Member Data Documentation

bool vpTracker::cPAvailable
inherited

Flag used to indicate if the feature parameters cP expressed in the camera frame are available.

Definition at line 81 of file vpTracker.h.

Referenced by vpTracker::init(), vpTracker::operator=(), and vpPoint::operator=().