Visual Servoing Platform  version 3.2.0 under development (2018-10-16)
vpPoint Class Reference

#include <visp3/core/vpPoint.h>

+ Inheritance diagram for vpPoint:

Public Types

enum  vpForwardProjectionDeallocatorType { user, vpDisplayForwardProjection }
 

Public Member Functions

 vpPoint ()
 
 vpPoint (double oX, double oY, double oZ)
 
 vpPoint (const vpColVector &P)
 
 vpPoint (const std::vector< double > &P)
 
virtual ~vpPoint ()
 
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)
 
void display (const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &color=vpColor::green, const unsigned int thickness=1)
 
vpPointduplicate () const
 
double get_X () const
 
double get_Y () const
 
double get_Z () const
 
double get_W () const
 
double get_oX () const
 
double get_oY () const
 
double get_oZ () const
 
double get_oW () const
 
double get_x () const
 
double get_y () const
 
double get_w () const
 
void getWorldCoordinates (double &oX, double &oY, double &oZ)
 
void getWorldCoordinates (vpColVector &P)
 
vpColVector getWorldCoordinates (void)
 
void getWorldCoordinates (std::vector< double > &P)
 
void init ()
 
vpPointoperator= (const vpPoint &vpp)
 
void projection (const vpColVector &_cP, vpColVector &_p)
 
void projection ()
 
void set_X (const double X)
 
void set_Y (const double Y)
 
void set_Z (const double Z)
 
void set_W (const double W)
 
void set_oX (const double oX)
 
void set_oY (const double oY)
 
void set_oZ (const double oZ)
 
void set_oW (const double oW)
 
void set_x (const double x)
 
void set_y (const double y)
 
void set_w (const double w)
 
void setWorldCoordinates (const double oX, const double oY, const double oZ)
 
void setWorldCoordinates (const vpColVector &P)
 
void setWorldCoordinates (const std::vector< double > &P)
 
void project ()
 
void project (const vpHomogeneousMatrix &cMo)
 
void track (const vpHomogeneousMatrix &cMo)
 
virtual void print () const
 
void setDeallocate (vpForwardProjectionDeallocatorType d)
 
vpForwardProjectionDeallocatorType getDeallocate ()
 

Public Attributes

vpColVector oP
 
vpColVector p
 
vpColVector cP
 
bool cPAvailable
 

Friends

VISP_EXPORT std::ostream & operator<< (std::ostream &os, const vpPoint &vpp)
 

Detailed Description

Class that defines what is a point.

Examples:
AROgre.cpp, AROgreBasic.cpp, homographyHartleyDLT2DObject.cpp, homographyHLM2DObject.cpp, homographyHLM3DObject.cpp, manGeometricFeatures.cpp, manServo4PointsDisplay.cpp, manServoMomentsSimple.cpp, manSimu4Dots.cpp, manSimu4Points.cpp, mbot-apriltag-ibvs.cpp, poseVirtualVS.cpp, servoAfma62DhalfCamVelocity.cpp, servoAfma6FourPoints2DCamVelocityInteractionCurrent.cpp, servoAfma6FourPoints2DCamVelocityInteractionDesired.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoMomentPoints.cpp, servoMomentPolygon.cpp, servoPioneerPanSegment3D.cpp, servoSimu4Points.cpp, servoSimuAfma6FourPoints2DCamVelocity.cpp, servoSimuFourPoints2DCamVelocity.cpp, servoSimuFourPoints2DCamVelocityDisplay.cpp, servoSimuFourPoints2DPolarCamVelocityDisplay.cpp, servoSimuPoint2DCamVelocity1.cpp, servoSimuPoint2DCamVelocity2.cpp, servoSimuPoint2DCamVelocity3.cpp, servoSimuPoint2DhalfCamVelocity1.cpp, servoSimuPoint2DhalfCamVelocity2.cpp, servoSimuPoint2DhalfCamVelocity3.cpp, servoSimuPoint3DCamVelocity.cpp, servoSimuViper850FourPoints2DCamVelocity.cpp, servoViper850FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper850FourPoints2DCamVelocityInteractionCurrent.cpp, servoViper850FourPointsKinect.cpp, simulateFourPoints2DCartesianCamVelocity.cpp, simulateFourPoints2DPolarCamVelocity.cpp, testConvert.cpp, testFeatureSegment.cpp, testFindMatch.cpp, testKeyPoint-4.cpp, testPoseFeatures.cpp, testPoseRansac.cpp, testPoseRansac2.cpp, testRobotAfma6Pose.cpp, testRobotViper850Pose.cpp, tutorial-chessboard-pose.cpp, tutorial-count-coins.cpp, tutorial-homography-from-points.cpp, tutorial-ibvs-4pts-display.cpp, tutorial-ibvs-4pts-image-tracking.cpp, tutorial-ibvs-4pts-ogre-tracking.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-wireframe-robot-afma6.cpp, tutorial-ibvs-4pts-wireframe-robot-viper.cpp, tutorial-ibvs-4pts.cpp, tutorial-pose-from-points-image.cpp, tutorial-pose-from-points-tracking.cpp, tutorial-pose-from-qrcode-image.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 58 of file vpPoint.h.

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

vpPoint::vpPoint ( )

Basic constructor.

Definition at line 64 of file vpPoint.cpp.

References init().

Referenced by changeFrame().

vpPoint::vpPoint ( double  oX,
double  oY,
double  oZ 
)

Construction from 3D coordinates in the object frame.

Parameters
oX,oY,oZCoordinates of a 3D point in the object frame.

Definition at line 70 of file vpPoint.cpp.

References init(), and setWorldCoordinates().

vpPoint::vpPoint ( const vpColVector P)
explicit

Construction from 3D point world coordinates. We mean here the coordinates of the point in the object frame.

Parameters
PVector containing the coordinates of the 3D point in the object frame. This vector could be of dimension 3 or 4.
  • If dimension is 3, P corresponds to the normalized coordinates P = (X, Y, Z, 1) where P[0]=X, P[1]=Y, P[2]=Z.
  • If dimension is 4, P corresponds to the normalized coordinates P = (X, Y, Z, W) where P[0]=X, P[1]=Y, P[2]=Z and P[3]=W.

Definition at line 86 of file vpPoint.cpp.

References init(), and setWorldCoordinates().

vpPoint::vpPoint ( const std::vector< double > &  P)
explicit

Construction from 3D point world coordinates. We mean here the coordinates of the point in the object frame.

Parameters
PVector containing the coordinates of the 3D point in the object frame. This vector could be of dimension 3 or 4.
  • If dimension is 3, P corresponds to the normalized coordinates P = (X, Y, Z, 1) where P[0]=X, P[1]=Y, P[2]=Z.
  • If dimension is 4, P corresponds to the normalized coordinates P = (X, Y, Z, W) where P[0]=X, P[1]=Y, P[2]=Z and P[3]=W.

Definition at line 102 of file vpPoint.cpp.

References init(), and setWorldCoordinates().

Member Function Documentation

void vpPoint::changeFrame ( const vpHomogeneousMatrix cMo)
virtual

From the 3D coordinates of the point in the object frame set using for example setWorldCoordinates() or set_oX(), set_oY(), set_oZ(), compute the 3D coordinates of the point in the camera frame.

Parameters
cMo: Transformation from camera to object frame.

Implements vpForwardProjection.

Definition at line 259 of file vpPoint.cpp.

References vpTracker::cP, duplicate(), get_W(), get_w(), get_X(), get_x(), get_Y(), get_y(), get_Z(), vpForwardProjection::oP, operator*(), set_oW(), set_oX(), set_oY(), set_oZ(), set_W(), set_w(), set_X(), set_x(), set_Y(), set_y(), set_Z(), and vpPoint().

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

Display the point in the image.

Implements vpForwardProjection.

Examples:
manGeometricFeatures.cpp, and servoAfma6Points2DCamVelocityEyeToHand.cpp.

Definition at line 403 of file vpPoint.cpp.

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

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

Display the point in the image.

Implements vpForwardProjection.

Definition at line 358 of file vpPoint.cpp.

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

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

Display the point in the image.

Definition at line 375 of file vpPoint.cpp.

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

vpPoint * vpPoint::duplicate ( ) const
virtual

For memory issue (used by the vpServo class only).

Implements vpForwardProjection.

Definition at line 349 of file vpPoint.cpp.

Referenced by changeFrame().

double vpPoint::get_oW ( ) const

Get the point W coordinate in the object frame.

Definition at line 426 of file vpPoint.cpp.

References vpForwardProjection::oP.

double vpPoint::get_W ( ) const

Get the point W coordinate in the camera frame.

Definition at line 417 of file vpPoint.cpp.

References vpTracker::cP.

Referenced by changeFrame(), vpHomogeneousMatrix::operator*(), and vpPlane::projectionPointOnPlan().

double vpPoint::get_w ( ) const

Get the point w coordinate in the image plane.

Examples:
homographyHartleyDLT2DObject.cpp, homographyHLM2DObject.cpp, and homographyHLM3DObject.cpp.

Definition at line 433 of file vpPoint.cpp.

References vpTracker::p.

Referenced by changeFrame(), and vpHomography::operator*().

vpForwardProjectionDeallocatorType vpForwardProjection::getDeallocate ( )
inlineinherited

Definition at line 220 of file vpForwardProjection.h.

void vpPoint::getWorldCoordinates ( double &  oX,
double &  oY,
double &  oZ 
)

Get the point world coordinates. We mean here the coordinates of the point in the object frame.

Definition at line 177 of file vpPoint.cpp.

References vpForwardProjection::oP.

void vpPoint::getWorldCoordinates ( vpColVector P)

Get the point world coordinates. We mean here the coordinates of the point in the object frame.

Parameters
PNormalized coordinates of the point in the object frame P = (X, Y, Z, 1)

Definition at line 189 of file vpPoint.cpp.

References vpForwardProjection::oP.

vpColVector vpPoint::getWorldCoordinates ( void  )

Return the point world coordinates. We mean here the coordinates of the point in the object frame.

Returns
Normalized coordinates of the point in the object frame P = (X, Y, Z, 1)

Definition at line 207 of file vpPoint.cpp.

References vpForwardProjection::oP.

void vpPoint::getWorldCoordinates ( std::vector< double > &  P)

Get the point world coordinates. We mean here the coordinates of the point in the object frame.

Parameters
PNormalized coordinates of the point in the object frame P = (X, Y, Z, 1)

Definition at line 195 of file vpPoint.cpp.

References vpForwardProjection::oP, vpColVector::resize(), and vpArray2D< Type >::size().

void vpPoint::init ( )
virtual

Basic construction.

Implements vpForwardProjection.

Definition at line 48 of file vpPoint.cpp.

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

Referenced by vpPoint().

vpPoint & vpPoint::operator= ( const vpPoint vpp)
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 vpPoint::projection ( const vpColVector _cP,
vpColVector _p 
)
virtual

Projection onto the image plane of a point. Input: the 3D coordinates in the camera frame _cP, output : the 2D coordinates _p.

Compute the perspective projection of a point _cP.

Parameters
_cP: Three dimension vector that corresponds to the coordinates of the point in the camera frame.
_p: Coordinates of the point in the image plane obtained by perspective projection.

Implements vpForwardProjection.

Examples:
servoAfma6FourPoints2DCamVelocityInteractionCurrent.cpp, servoAfma6FourPoints2DCamVelocityInteractionDesired.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoViper850FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper850FourPoints2DCamVelocityInteractionCurrent.cpp, and servoViper850FourPointsKinect.cpp.

Definition at line 216 of file vpPoint.cpp.

References vpColVector::resize().

Referenced by vpPolygon3D::changeFrame(), vpPolygon3D::computePolygonClipped(), vpMbtDistanceCylinder::display(), vpMbtDistanceCylinder::initMovingEdge(), and vpMbtDistanceCylinder::updateMovingEdge().

void vpPoint::projection ( )
virtual

Perspective projection of the point.

Projection onto the //image plane of the point. Update the object attribute p (2D //homogeneous coordinates) according to object attribute cP (current //3D coordinates in the camera frame).

Implements vpForwardProjection.

Definition at line 443 of file vpPoint.cpp.

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

Referenced by display().

void vpPoint::set_oW ( const double  oW)

Set the point W coordinate in the object frame.

Definition at line 467 of file vpPoint.cpp.

References vpForwardProjection::oP.

Referenced by changeFrame(), and vpHomogeneousMatrix::operator*().

void vpPoint::set_oX ( const double  oX)
void vpPoint::set_oY ( const double  oY)
void vpPoint::set_oZ ( const double  oZ)
void vpPoint::set_W ( const double  W)

Set the point W coordinate in the camera frame.

Definition at line 458 of file vpPoint.cpp.

References vpTracker::cP.

Referenced by changeFrame(), vpHomogeneousMatrix::operator*(), and vpPlane::projectionPointOnPlan().

void vpPoint::set_w ( const double  w)

Set the point w coordinate in the image plane.

Definition at line 474 of file vpPoint.cpp.

References vpTracker::p.

Referenced by changeFrame(), and vpHomography::operator*().

void vpForwardProjection::setDeallocate ( vpForwardProjectionDeallocatorType  d)
inlineinherited

Definition at line 219 of file vpForwardProjection.h.

void vpPoint::setWorldCoordinates ( const double  oX,
const double  oY,
const double  oZ 
)

Set the 3D point world coordinates. We mean here the coordinates of the point in the object frame.

Parameters
oX,oY,oZCoordinates of a 3D point in the object frame.
Examples:
AROgre.cpp, AROgreBasic.cpp, homographyHartleyDLT2DObject.cpp, homographyHLM2DObject.cpp, homographyHLM3DObject.cpp, manGeometricFeatures.cpp, manServo4PointsDisplay.cpp, manSimu4Dots.cpp, manSimu4Points.cpp, poseVirtualVS.cpp, servoAfma62DhalfCamVelocity.cpp, servoAfma6FourPoints2DCamVelocityInteractionCurrent.cpp, servoAfma6FourPoints2DCamVelocityInteractionDesired.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoPioneerPanSegment3D.cpp, servoSimu4Points.cpp, servoSimuAfma6FourPoints2DCamVelocity.cpp, servoSimuFourPoints2DCamVelocity.cpp, servoSimuFourPoints2DCamVelocityDisplay.cpp, servoSimuFourPoints2DPolarCamVelocityDisplay.cpp, servoSimuViper850FourPoints2DCamVelocity.cpp, servoViper850FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper850FourPoints2DCamVelocityInteractionCurrent.cpp, servoViper850FourPointsKinect.cpp, simulateFourPoints2DCartesianCamVelocity.cpp, simulateFourPoints2DPolarCamVelocity.cpp, testFeatureSegment.cpp, testRobotAfma6Pose.cpp, testRobotViper850Pose.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, and tutorial-ibvs-4pts.cpp.

Definition at line 113 of file vpPoint.cpp.

References vpForwardProjection::oP.

Referenced by vpMbTracker::addPolygon(), vpMbTracker::addProjectionErrorPolygon(), vpKeyPoint::compute3D(), vpKeyPoint::compute3DForPointsOnCylinders(), vpMbtFaceDepthNormal::computeDesiredNormalAndCentroid(), vpMbTracker::extractCylinders(), vpMbTracker::extractFaces(), vpMbTracker::extractLines(), vpMbTracker::getGravityCenter(), vpProjectionDisplay::init(), vpMbtDistanceKltCylinder::init(), vpMbTracker::initFromPoints(), vpMbTracker::loadCAOModel(), vpKeyPoint::matchPoint(), vpPose::poseFromRectangle(), vpWireFrameSimulator::projectCameraTrajectory(), and vpPoint().

void vpPoint::setWorldCoordinates ( const vpColVector P)
virtual

Set the 3D point world coordinates. We mean here the coordinates of the point in the object frame.

Parameters
PVector containing the coordinates of the 3D point in the object frame. This vector could be of dimension 3 or 4.
  • If dimension is 3, P corresponds to the normalized coordinates P = (X, Y, Z, 1) where P[0]=X, P[1]=Y, P[2]=Z.
  • If dimension is 4, P corresponds to the normalized coordinates P = (X, Y, Z, W) where P[0]=X, P[1]=Y, P[2]=Z and P[3]=W.

Implements vpForwardProjection.

Definition at line 130 of file vpPoint.cpp.

References vpException::dimensionError, vpForwardProjection::oP, and vpArray2D< Type >::size().

void vpPoint::setWorldCoordinates ( const std::vector< double > &  P)

Set the 3D point world coordinates. We mean here the coordinates of the point in the object frame.

Parameters
PVector containing the coordinates of the 3D point in the object frame. This vector could be of dimension 3 or 4.
  • If dimension is 3, P corresponds to the normalized coordinates P = (X, Y, Z, 1) where P[0]=X, P[1]=Y, P[2]=Z.
  • If dimension is 4, P corresponds to the normalized coordinates P = (X, Y, Z, W) where P[0]=X, P[1]=Y, P[2]=Z and P[3]=W.

Definition at line 157 of file vpPoint.cpp.

References vpException::dimensionError, and 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().

Friends And Related Function Documentation

VISP_EXPORT std::ostream& operator<< ( std::ostream &  os,
const vpPoint vpp 
)
friend

Definition at line 388 of file vpPoint.cpp.

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 operator=().