Visual Servoing Platform  version 3.6.1 under development (2024-11-21)
vpForwardProjection Class Referenceabstract

#include <visp3/core/vpForwardProjection.h>

+ Inheritance diagram for vpForwardProjection:

Public Types

enum  vpForwardProjectionDeallocatorType { user , vpDisplayForwardProjection }
 

Public Member Functions

Public Member Functions Inherited from vpForwardProjection
 vpForwardProjection ()
 
virtual void changeFrame (const vpHomogeneousMatrix &cMo, vpColVector &cP) const =0
 
virtual void changeFrame (const vpHomogeneousMatrix &cMo)=0
 
virtual void display (const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpColor &color=vpColor::green, unsigned int thickness=1)=0
 
virtual void display (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &color=vpColor::green, unsigned int thickness=1)=0
 
virtual vpForwardProjectionduplicate () const =0
 
vpColVector get_oP () const
 
vpForwardProjectionDeallocatorType getDeallocate ()
 
virtual void print () const
 
virtual void projection (const vpColVector &cP, vpColVector &p) const =0
 
virtual void projection ()=0
 
void project ()
 
void project (const vpHomogeneousMatrix &cMo)
 
void setDeallocate (vpForwardProjectionDeallocatorType d)
 
virtual void setWorldCoordinates (const vpColVector &oP)=0
 
void track (const vpHomogeneousMatrix &cMo)
 
Public Member Functions Inherited from vpTracker
vpColVector get_p () const
 
vpColVector get_cP () const
 

Public Attributes

Public Attributes Inherited from vpForwardProjection
vpColVector oP
 
Public Attributes Inherited from vpTracker
vpColVector p
 
vpColVector cP
 
bool cPAvailable
 

Protected Member Functions Inherited from vpForwardProjection

virtual void init ()=0
 

Detailed Description

Class that defines what is a generic geometric feature.

Each geometric feature has parameters expressed:

  • in the object frame oP. These parameters are located in the public attribute vpForwardProjection::oP.
  • in the camera frame cP. These parameters are located in the public attribute vpTracker::cP.
  • in the image plane p. These parameters are located in the public attribute vpTracker::p. They correspond to normalized coordinates of the feature expressed in meters.

Definition at line 64 of file vpForwardProjection.h.

Member Enumeration Documentation

◆ vpForwardProjectionDeallocatorType

Used for memory issue especially in the vpServo class.

Enumerator
user 
vpDisplayForwardProjection 

Definition at line 70 of file vpForwardProjection.h.

Constructor & Destructor Documentation

◆ vpForwardProjection()

vpForwardProjection::vpForwardProjection ( )
inline

Definition at line 74 of file vpForwardProjection.h.

Member Function Documentation

◆ changeFrame() [1/2]

virtual void vpForwardProjection::changeFrame ( const vpHomogeneousMatrix cMo)
pure virtual

Computes the features parameters in the camera frame (cP) thanks to the parameters given in the object frame (vpForwardProjection::oP) and the homogeneous matrix relative to the pose (cMo) between the object frame and the camera frame.

To set the parameters in the object frame you need to call setWorldCoordinates().

Parameters
cMo: The homogeneous matrix corresponding to the pose between the camera frame and the object frame.

The features parameters in the camera frame (cP) are updated in the vpTracker::cP public attribute.

Implemented in vpSphere, vpPoint, vpLine, vpCylinder, and vpCircle.

◆ changeFrame() [2/2]

virtual void vpForwardProjection::changeFrame ( const vpHomogeneousMatrix cMo,
vpColVector cP 
) const
pure virtual

Computes the features parameters in the camera frame (cP) thanks to the parameters given in the object frame (vpForwardProjection::oP) and the homogeneous matrix relative to the pose (cMo) between the object frame and the camera frame.

To set the parameters in the object frame you need to call setWorldCoordinates().

Parameters
cMo: The homogeneous matrix corresponding to the pose between the camera frame and the object frame.
cP: The vector which will contain the feature parameters expressed in the camera frame.

With this method, the vpTracker::cP public attribute is not updated.

Implemented in vpCircle, vpSphere, vpPoint, vpLine, and vpCylinder.

Referenced by project().

◆ display() [1/2]

virtual void vpForwardProjection::display ( const vpImage< unsigned char > &  I,
const vpCameraParameters cam,
const vpColor color = vpColor::green,
unsigned int  thickness = 1 
)
pure 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.

Implemented in vpSphere, vpPoint, vpLine, vpCylinder, and vpCircle.

Referenced by vpProjectionDisplay::display().

◆ display() [2/2]

virtual void vpForwardProjection::display ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo,
const vpCameraParameters cam,
const vpColor color = vpColor::green,
unsigned int  thickness = 1 
)
pure 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.

Implemented in vpSphere, vpPoint, vpLine, vpCylinder, and vpCircle.

◆ duplicate()

virtual vpForwardProjection* vpForwardProjection::duplicate ( ) const
pure virtual

Create an object with the same type.

Implemented in vpSphere, vpPoint, vpLine, vpCylinder, and vpCircle.

◆ get_cP()

vpColVector vpTracker::get_cP ( ) const
inlineinherited

Return object parameters expressed in the 3D camera frame.

Definition at line 95 of file vpTracker.h.

◆ get_oP()

vpColVector vpForwardProjection::get_oP ( ) const
inline

Return object parameters expressed in the 3D object frame.

Definition at line 155 of file vpForwardProjection.h.

◆ get_p()

vpColVector vpTracker::get_p ( ) const
inlineinherited

Return object parameters expressed in the 2D image plane computed by perspective projection.

Definition at line 93 of file vpTracker.h.

◆ getDeallocate()

vpForwardProjectionDeallocatorType vpForwardProjection::getDeallocate ( )
inline

Definition at line 157 of file vpForwardProjection.h.

◆ init()

virtual void vpForwardProjection::init ( )
protectedpure virtual

Default initialisation of the feature parameters:

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

Implemented in vpSphere, vpPoint, vpLine, vpCylinder, and vpCircle.

◆ print()

BEGIN_VISP_NAMESPACE void vpForwardProjection::print ( ) const
virtual

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 49 of file vpForwardProjection.cpp.

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

◆ project() [1/2]

◆ project() [2/2]

void vpForwardProjection::project ( const vpHomogeneousMatrix cMo)

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 80 of file vpForwardProjection.cpp.

References changeFrame(), and projection().

◆ projection() [1/2]

virtual void vpForwardProjection::projection ( )
pure virtual

Computes the feature parameters in the image plane. These parameters are than updated in the vpTracker::p public attribute.

Warning
To compute these parameters, the method exploit the feature parameters in the camera frame. Thus, vpTracker::cP need to be updated before the call of this method. For that, a call to changeFrame(const vpHomogeneousMatrix &) is requested.

Implemented in vpSphere, vpPoint, vpLine, vpCylinder, and vpCircle.

Referenced by project().

◆ projection() [2/2]

virtual void vpForwardProjection::projection ( const vpColVector cP,
vpColVector p 
) const
pure virtual

Computes the feature parameters in the image plane from the parameters expressed in the camera frame.

Parameters
cP[input] : Feature parameters expressed in the camera frame.
p[output] : Feature parameters expressed in the image plane.

Implemented in vpSphere, vpLine, vpCylinder, vpCircle, and vpPoint.

◆ setDeallocate()

void vpForwardProjection::setDeallocate ( vpForwardProjectionDeallocatorType  d)
inline

Definition at line 185 of file vpForwardProjection.h.

◆ setWorldCoordinates()

virtual void vpForwardProjection::setWorldCoordinates ( const vpColVector oP)
pure virtual

Sets the parameters which define the feature in the object frame.

Parameters
oP: Feature parameters expressed in the object frame used to set the vpForwardProjection::oP public attribute.

Implemented in vpSphere, vpPoint, vpLine, vpCylinder, and vpCircle.

◆ track()

void vpForwardProjection::track ( const vpHomogeneousMatrix cMo)

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, 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, testPoint.cpp, tutorial-ibvs-4pts-json.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 102 of file vpForwardProjection.cpp.

References project().

Referenced by vpPose::computeResidual(), vpProjectionDisplay::displayCamera(), vpImageDraw::drawFrame(), vpPose::poseVirtualVS(), vpPose::poseVirtualVSrobust(), and vpWireFrameSimulator::projectCameraTrajectory().

Member Data Documentation

◆ cP

◆ cPAvailable

bool vpTracker::cPAvailable
inherited

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

Definition at line 79 of file vpTracker.h.

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

◆ oP

◆ p