Visual Servoing Platform  version 3.3.0
vpSphere Class Reference

#include <vpSphere.h>

+ Inheritance diagram for vpSphere:

Public Types

enum  vpForwardProjectionDeallocatorType { user, vpDisplayForwardProjection }
 

Public Member Functions

void init ()
 
 vpSphere ()
 
virtual ~vpSphere ()
 
 vpSphere (const vpColVector &oP)
 
 vpSphere (double X0, double Y0, double Z0, double R)
 
void setWorldCoordinates (const vpColVector &oP)
 
void setWorldCoordinates (double X0, double Y0, double Z0, double R)
 
double get_x () const
 
double get_y () const
 
double get_mu20 () const
 
double get_mu11 () const
 
double get_mu02 () 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, unsigned int thickness=1)
 
void display (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &color=vpColor::green, unsigned int thickness=1)
 
vpSphereduplicate () const
 
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
 

Detailed Description

Class that defines what is a sphere.

Forward projection of a sphere.

Examples
manGeometricFeatures.cpp, servoSimuSphere.cpp, servoSimuSphere2DCamVelocity.cpp, servoSimuSphere2DCamVelocityDisplay.cpp, and servoSimuSphere2DCamVelocityDisplaySecondaryTask.cpp.

Definition at line 59 of file vpSphere.h.

Member Enumeration Documentation

◆ vpForwardProjectionDeallocatorType

Used for memory issue especially in the vpServo class.

Enumerator
user 
vpDisplayForwardProjection 

Definition at line 210 of file vpForwardProjection.h.

Constructor & Destructor Documentation

◆ vpSphere() [1/3]

vpSphere::vpSphere ( )

Definition at line 60 of file vpSphere.cpp.

References init().

◆ ~vpSphere()

vpSphere::~vpSphere ( )
virtual

Definition at line 74 of file vpSphere.cpp.

◆ vpSphere() [2/3]

vpSphere::vpSphere ( const vpColVector oP)
explicit

Definition at line 62 of file vpSphere.cpp.

References init(), and setWorldCoordinates().

◆ vpSphere() [3/3]

vpSphere::vpSphere ( double  X0,
double  Y0,
double  Z0,
double  R 
)

Definition at line 68 of file vpSphere.cpp.

References init(), and setWorldCoordinates().

Member Function Documentation

◆ changeFrame() [1/2]

void vpSphere::changeFrame ( const vpHomogeneousMatrix cMo)
virtual

perspective projection of the circle

Implements vpForwardProjection.

Definition at line 143 of file vpSphere.cpp.

◆ changeFrame() [2/2]

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

Perspective projection of the circle.

Implements vpForwardProjection.

Definition at line 146 of file vpSphere.cpp.

Referenced by display().

◆ display() [1/2]

void vpSphere::display ( const vpImage< unsigned char > &  I,
const vpCameraParameters cam,
const vpColor color = vpColor::green,
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 178 of file vpSphere.cpp.

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

◆ display() [2/2]

void vpSphere::display ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo,
const vpCameraParameters cam,
const vpColor color = vpColor::green,
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 169 of file vpSphere.cpp.

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

◆ duplicate()

vpSphere * vpSphere::duplicate ( ) const
virtual

for memory issue (used by the vpServo class only)

Implements vpForwardProjection.

Definition at line 162 of file vpSphere.cpp.

◆ get_mu02()

double vpSphere::get_mu02 ( ) const
inline
Examples
servoSimuSphere.cpp.

Definition at line 77 of file vpSphere.h.

◆ get_mu11()

double vpSphere::get_mu11 ( ) const
inline
Examples
servoSimuSphere.cpp.

Definition at line 76 of file vpSphere.h.

◆ get_mu20()

double vpSphere::get_mu20 ( ) const
inline
Examples
servoSimuSphere.cpp.

Definition at line 75 of file vpSphere.h.

◆ get_x()

double vpSphere::get_x ( ) const
inline
Examples
servoSimuSphere.cpp.

Definition at line 73 of file vpSphere.h.

◆ get_y()

double vpSphere::get_y ( ) const
inline
Examples
servoSimuSphere.cpp.

Definition at line 74 of file vpSphere.h.

◆ getDeallocate()

vpForwardProjectionDeallocatorType vpForwardProjection::getDeallocate ( )
inlineinherited

Definition at line 219 of file vpForwardProjection.h.

◆ getR()

double vpSphere::getR ( ) const
inline
Examples
servoSimuSphere.cpp.

Definition at line 83 of file vpSphere.h.

◆ getX()

double vpSphere::getX ( ) const
inline

Definition at line 79 of file vpSphere.h.

◆ getY()

double vpSphere::getY ( ) const
inline

Definition at line 80 of file vpSphere.h.

◆ getZ()

double vpSphere::getZ ( ) const
inline

Definition at line 81 of file vpSphere.h.

◆ init()

void vpSphere::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 41 of file vpSphere.cpp.

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

Referenced by vpSphere().

◆ print()

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

◆ project() [1/2]

◆ project() [2/2]

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

◆ projection() [1/2]

void vpSphere::projection ( )
virtual

perspective projection of the sphere

Implements vpForwardProjection.

Definition at line 77 of file vpSphere.cpp.

Referenced by display().

◆ projection() [2/2]

void vpSphere::projection ( const vpColVector cP,
vpColVector p 
)
virtual

Perspective projection of the circle.

Implements vpForwardProjection.

Definition at line 80 of file vpSphere.cpp.

◆ setDeallocate()

void vpForwardProjection::setDeallocate ( vpForwardProjectionDeallocatorType  d)
inlineinherited

Definition at line 218 of file vpForwardProjection.h.

◆ setWorldCoordinates() [1/2]

void vpSphere::setWorldCoordinates ( const vpColVector oP)
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.

Implements vpForwardProjection.

Examples
manGeometricFeatures.cpp, servoSimuSphere2DCamVelocity.cpp, servoSimuSphere2DCamVelocityDisplay.cpp, and servoSimuSphere2DCamVelocityDisplaySecondaryTask.cpp.

Definition at line 50 of file vpSphere.cpp.

References vpForwardProjection::oP.

Referenced by vpSphere().

◆ setWorldCoordinates() [2/2]

void vpSphere::setWorldCoordinates ( double  X0,
double  Y0,
double  Z0,
double  R 
)

Definition at line 52 of file vpSphere.cpp.

References vpForwardProjection::oP.

◆ track()

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

Referenced by vpProjectionDisplay::displayCamera(), vpWireFrameSimulator::projectCameraTrajectory(), and vpSimulatorAfma6::updateArticularPosition().

Member Data Documentation

◆ cP

vpColVector vpTracker::cP
inherited

Feature coordinates expressed in the camera frame cP.

Definition at line 74 of file vpTracker.h.

Referenced by vpCircle::init(), init(), vpCylinder::init(), vpTracker::operator=(), and vpPose::printPoint().

◆ cPAvailable

bool vpTracker::cPAvailable
inherited

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

Definition at line 80 of file vpTracker.h.

Referenced by vpTracker::operator=().

◆ oP

vpColVector vpForwardProjection::oP
inherited

Feature coordinates expressed in the object frame, also called world frame.

Definition at line 73 of file vpForwardProjection.h.

Referenced by vpCircle::init(), init(), vpCylinder::init(), vpPose::printPoint(), and setWorldCoordinates().

◆ p

vpColVector vpTracker::p
inherited

Feature coordinates expressed in the image plane p. They correspond to 2D normalized coordinates expressed in meters.

Definition at line 70 of file vpTracker.h.

Referenced by vpCircle::display(), display(), vpProjectionDisplay::display(), vpProjectionDisplay::displayCamera(), vpCircle::init(), init(), vpMeTracker::init(), vpCylinder::init(), vpTracker::operator=(), and vpPose::printPoint().