Visual Servoing Platform
version 3.5.0 under development (2022-02-15)
|
#include <visp3/core/vpCylinder.h>
Public Types | |
enum | vpLineCylinderType { line1, line2 } |
enum | vpForwardProjectionDeallocatorType { user, vpDisplayForwardProjection } |
Public Member Functions | |
vpCylinder () | |
vpCylinder (const vpColVector &oP) | |
vpCylinder (double oA, double oB, double oC, double oX, double oY, double oZ, double R) | |
virtual | ~vpCylinder () |
void | changeFrame (const vpHomogeneousMatrix &cMo, vpColVector &cP) const |
void | changeFrame (const vpHomogeneousMatrix &cMo) |
double | computeZ (double x, double y) const |
void | display (const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpColor &color=vpColor::green, unsigned int thickness=1) |
void | display (const vpImage< vpRGBa > &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) |
void | display (const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &color=vpColor::green, unsigned int thickness=1) |
vpCylinder * | duplicate () const |
double | getRho1 () const |
double | getTheta1 () const |
double | getRho2 () const |
double | getTheta2 () const |
double | getA () const |
double | getB () const |
double | getC () const |
double | getX () const |
double | getY () const |
double | getZ () const |
double | getR () const |
void | init () |
void | projection () |
void | projection (const vpColVector &cP, vpColVector &p) const |
void | setWorldCoordinates (const vpColVector &oP) |
void | setWorldCoordinates (double oA, double oB, double oC, double oX, double oY, double oZ, double R) |
Public Member Functions Inherited from vpForwardProjection | |
vpColVector | get_oP () const |
vpForwardProjectionDeallocatorType | getDeallocate () |
virtual void | print () const |
void | project () |
void | project (const vpHomogeneousMatrix &cMo) |
void | setDeallocate (vpForwardProjectionDeallocatorType d) |
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 |
Class that defines a 3D cylinder in the object frame and allows forward projection of a 3D cylinder in the camera frame and in the 2D image plane by perspective projection. All the parameters must be set in meter.
A 3D cylinder of radius R is defined by the set of circles of radius R whose center belongs to a straight line perpendicular to the plane of the circles.
A 3D cylinder has the followings parameters:
where R is the radius of the cylinder, oA, oB, oC are the coordinates of its direction vector and oX, oY, oZ are the coordinates of the nearest point belonging to the cylinder axis from the projection center. The corresponding parameters are located in vpForwardProjection::oP 7-dim internal vector. They correspond to oP = (oA, oB, oC, oX, oY, oZ, R). Setting the cylinder parameters is achieved through the constructors with parameters or setWorldCoordinates() methods. To get theses parameters use get_oP().
Perspective projection is achieved using projection() methods. The methods get_p(), getRho1(), getTheta1() and getRho2(), getTheta2() allow to access to the projected line parameters.
Definition at line 102 of file vpCylinder.h.
|
inherited |
Used for memory issue especially in the vpServo class.
Enumerator | |
---|---|
user | |
vpDisplayForwardProjection |
Definition at line 73 of file vpForwardProjection.h.
Enumerator | |
---|---|
line1 | First limb of the cylinder. |
line2 | Second limb of the cylinder. |
Definition at line 105 of file vpCylinder.h.
vpCylinder::vpCylinder | ( | ) |
Default constructor.
Definition at line 88 of file vpCylinder.cpp.
References init().
Referenced by duplicate().
|
explicit |
Create and initialize a cylinder with parameters oP = (oA, oB, oC, oX, oY, oZ, R) expressed in the object frame.
o_P | : 7-dim vector of parameters. |
Definition at line 105 of file vpCylinder.cpp.
References init(), and setWorldCoordinates().
vpCylinder::vpCylinder | ( | double | oA, |
double | oB, | ||
double | oC, | ||
double | oX, | ||
double | oY, | ||
double | oZ, | ||
double | R | ||
) |
Create and initialize a cylinder with parameters oP = (oA, oB, oC, oX, oY, oZ, R) expressed in the object frame.
oA,oB,oC,oX,oY,oZ,R | : Cylinder parameters expressed in the object frame. |
Definition at line 120 of file vpCylinder.cpp.
References init(), and setWorldCoordinates().
|
virtual |
Default constructor.
Definition at line 129 of file vpCylinder.cpp.
|
virtual |
From the cylinder parameters oP expressed in the object frame, compute the cylinder parameters cP expressed in the camera frame.
cMo | : Camera to object frame transformation. |
cP_ | [out] : Parameters cP expressed in the camera frame. |
Implements vpForwardProjection.
Definition at line 249 of file vpCylinder.cpp.
References vpForwardProjection::oP, and vpColVector::resize().
Referenced by changeFrame(), vpMbtDistanceKltCylinder::computeInteractionMatrixAndResidu(), vpMbtDistanceCylinder::computeInteractionMatrixError(), display(), vpMbtDistanceKltCylinder::getModelForDisplay(), vpMbtDistanceCylinder::getModelForDisplay(), vpMbtDistanceKltCylinder::init(), vpMbtDistanceCylinder::initMovingEdge(), and vpMbtDistanceCylinder::updateMovingEdge().
|
virtual |
From the cylinder oP parameters expressed in the object frame, compute the cylinder internal parameters cP expressed in the camera frame.
cMo | : Camera to object frame transformation. |
Implements vpForwardProjection.
Definition at line 237 of file vpCylinder.cpp.
References changeFrame(), and vpTracker::cP.
double vpCylinder::computeZ | ( | double | x, |
double | y | ||
) | const |
Compute the Z coordinate for the given normalized coordinate in the camera frame.
Definition at line 344 of file vpCylinder.cpp.
References getA(), getB(), getC(), getR(), getX(), getY(), and getZ().
Referenced by vpMbtDistanceKltCylinder::getModelForDisplay().
|
virtual |
Display the projection of a 3D cylinder in image I as two lines corresponding to the limbs.
I | : Image used as background. |
cam | : Camera parameters. |
color | : Color used to draw the point. |
thickness | : Thickness used to draw the point. |
Implements vpForwardProjection.
Definition at line 412 of file vpCylinder.cpp.
References vpFeatureDisplay::displayCylinder(), and vpTracker::p.
void vpCylinder::display | ( | const vpImage< vpRGBa > & | I, |
const vpCameraParameters & | cam, | ||
const vpColor & | color = vpColor::green , |
||
unsigned int | thickness = 1 |
||
) |
Display the projection of a 3D cylinder in image I as two lines corresponding to the limbs.
I | : Image used as background. |
cam | : Camera parameters. |
color | : Color used to draw the point. |
thickness | : Thickness used to draw the point. |
Definition at line 426 of file vpCylinder.cpp.
References vpFeatureDisplay::displayCylinder(), and vpTracker::p.
|
virtual |
Display the projection of a 3D cylinder in image I as two lines corresponding to the limbs. This method is non destructive wrt. cP and p internal 3D point parameters.
I | : Image used as background. |
cMo | : Homogeneous transformation from camera frame to object frame. The point is considered as viewed from this camera position. |
cam | : Camera parameters. |
color | : Color used to draw the sphere. |
thickness | : Thickness used to draw the sphere. |
Implements vpForwardProjection.
Definition at line 372 of file vpCylinder.cpp.
References changeFrame(), vpFeatureDisplay::displayCylinder(), and projection().
void vpCylinder::display | ( | const vpImage< vpRGBa > & | I, |
const vpHomogeneousMatrix & | cMo, | ||
const vpCameraParameters & | cam, | ||
const vpColor & | color = vpColor::green , |
||
unsigned int | thickness = 1 |
||
) |
Display the projection of a 3D cylinder in image I as two lines corresponding to the limbs. This method is non destructive wrt. cP and p internal 3D point parameters.
I | : Image used as background. |
cMo | : Homogeneous transformation from camera frame to object frame. The point is considered as viewed from this camera position. |
cam | : Camera parameters. |
color | : Color used to draw the sphere. |
thickness | : Thickness used to draw the sphere. |
Definition at line 394 of file vpCylinder.cpp.
References changeFrame(), vpFeatureDisplay::displayCylinder(), and projection().
|
virtual |
For memory issue (used by the vpServo class only).
Implements vpForwardProjection.
Definition at line 354 of file vpCylinder.cpp.
References vpCylinder().
|
inlineinherited |
Return object parameters expressed in the 3D camera frame.
Definition at line 99 of file vpTracker.h.
|
inlineinherited |
Return object parameters expressed in the 3D object frame.
Definition at line 165 of file vpForwardProjection.h.
|
inlineinherited |
Return object parameters expressed in the 2D image plane computed by perspective projection.
Definition at line 97 of file vpTracker.h.
|
inline |
Return cylinder cA parameter expressed in the camera frame.
Definition at line 160 of file vpCylinder.h.
Referenced by computeZ(), and vpFeatureBuilder::create().
|
inline |
Return cylinder cB parameter expressed in the camera frame.
Definition at line 164 of file vpCylinder.h.
Referenced by computeZ(), and vpFeatureBuilder::create().
|
inline |
Return cylinder cC parameter expressed in the camera frame.
Definition at line 168 of file vpCylinder.h.
Referenced by computeZ(), and vpFeatureBuilder::create().
|
inlineinherited |
Definition at line 167 of file vpForwardProjection.h.
|
inline |
Return cylinder R parameter corresponding to the cylinder radius.
Definition at line 184 of file vpCylinder.h.
References vpForwardProjection::init(), vpForwardProjection::projection(), and vpForwardProjection::setWorldCoordinates().
Referenced by computeZ(), and vpFeatureBuilder::create().
|
inline |
Return the parameter of the line corresponding to the projection of the cylinder in the image plane.
Definition at line 136 of file vpCylinder.h.
Referenced by vpFeatureBuilder::create(), vpMbtDistanceKltCylinder::getModelForDisplay(), vpMbtDistanceCylinder::getModelForDisplay(), vpMbtDistanceCylinder::initMovingEdge(), and vpMbtDistanceCylinder::updateMovingEdge().
|
inline |
Return the parameter of the line corresponding to the projection of the cylinder in the image plane.
Definition at line 149 of file vpCylinder.h.
Referenced by vpFeatureBuilder::create(), vpMbtDistanceKltCylinder::getModelForDisplay(), vpMbtDistanceCylinder::getModelForDisplay(), vpMbtDistanceCylinder::initMovingEdge(), and vpMbtDistanceCylinder::updateMovingEdge().
|
inline |
Return the parameter of the line corresponding to the projection of the cylinder in the image plane.
Definition at line 142 of file vpCylinder.h.
Referenced by vpFeatureBuilder::create(), vpMbtDistanceKltCylinder::getModelForDisplay(), vpMbtDistanceCylinder::getModelForDisplay(), vpMbtDistanceCylinder::initMovingEdge(), and vpMbtDistanceCylinder::updateMovingEdge().
|
inline |
Return the parameter of the line corresponding to the projection of the cylinder in the image plane.
Definition at line 155 of file vpCylinder.h.
Referenced by vpFeatureBuilder::create(), vpMbtDistanceKltCylinder::getModelForDisplay(), vpMbtDistanceCylinder::getModelForDisplay(), vpMbtDistanceCylinder::initMovingEdge(), and vpMbtDistanceCylinder::updateMovingEdge().
|
inline |
Return cylinder cX parameter expressed in the camera frame.
Definition at line 172 of file vpCylinder.h.
Referenced by computeZ(), and vpFeatureBuilder::create().
|
inline |
Return cylinder cY parameter expressed in the camera frame.
Definition at line 176 of file vpCylinder.h.
Referenced by computeZ(), and vpFeatureBuilder::create().
|
inline |
Return cylinder cZ parameter expressed in the camera frame.
Definition at line 180 of file vpCylinder.h.
Referenced by computeZ(), and vpFeatureBuilder::create().
|
virtual |
Default initialisation of the feature parameters:
Implements vpForwardProjection.
Definition at line 42 of file vpCylinder.cpp.
References vpTracker::cP, vpForwardProjection::oP, vpTracker::p, and vpColVector::resize().
Referenced by vpCylinder().
|
virtualinherited |
Print to stdout the feature parameters in:
Definition at line 53 of file vpForwardProjection.cpp.
References vpTracker::cP, vpForwardProjection::oP, vpTracker::p, and vpColVector::t().
|
inherited |
Compute the feature parameters in the image plane (vpTracker::p) from the parameters in the camera frame (vpTracker::cP).
Definition at line 68 of file vpForwardProjection.cpp.
References vpTracker::cP, vpTracker::p, and vpForwardProjection::projection().
Referenced by vpMbtDistanceKltCylinder::computeInteractionMatrixAndResidu(), vpMbtFaceDepthNormal::computeNormalVisibility(), vpKeyPoint::computePose(), vpMbtFaceDepthDense::computeROI(), vpMbtFaceDepthNormal::displayFeature(), vpMbtFaceDepthNormal::getFeaturesForDisplay(), vpKeyPoint::matchPointAndDetect(), vpForwardProjection::track(), vpMbtDistanceCircle::~vpMbtDistanceCircle(), vpMbtDistanceCylinder::~vpMbtDistanceCylinder(), and vpMbtDistanceLine::~vpMbtDistanceLine().
|
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).
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(), and vpForwardProjection::projection().
|
virtual |
Perspective projection of the cylinder.
From the parameters of the cylinder in the camera frame, compute the perspective projection of the cylinder in the image plane.
Implements vpForwardProjection.
Definition at line 154 of file vpCylinder.cpp.
References vpTracker::cP, and vpTracker::p.
Referenced by vpMbtDistanceCylinder::computeInteractionMatrixError(), display(), vpMbtDistanceKltCylinder::getModelForDisplay(), vpMbtDistanceCylinder::getModelForDisplay(), vpMbtDistanceCylinder::initMovingEdge(), and vpMbtDistanceCylinder::updateMovingEdge().
|
virtual |
Perspective projection of the cylinder.
From the parameters of the cylinder in the camera frame , compute the perspective projection of the cylinder in the image plane.
cP_ | [in] : Cylinder parameters in the camera frame. |
p_ | [out] : Parameters of the cylinder in the image plane obtained by perspective projection. |
vpException::fatalError | : The camera is inside the cylinder. |
Implements vpForwardProjection.
Definition at line 184 of file vpCylinder.cpp.
References vpException::fatalError, and vpColVector::resize().
|
inlineinherited |
Definition at line 196 of file vpForwardProjection.h.
References vpTracker::init().
|
virtual |
Set the cylinder parameters expressed in the world frame.
o_P | : Vector of parameters . |
Implements vpForwardProjection.
Definition at line 65 of file vpCylinder.cpp.
References vpForwardProjection::oP.
Referenced by vpMbtDistanceKltCylinder::buildFrom(), vpMbtDistanceCylinder::buildFrom(), and vpCylinder().
void vpCylinder::setWorldCoordinates | ( | double | oA, |
double | oB, | ||
double | oC, | ||
double | oX, | ||
double | oY, | ||
double | oZ, | ||
double | R | ||
) |
Set the cylinder parameters oP = (oA, oB, oC, oX, oY, oZ, R) expressed in the object frame.
oA,oB,oC,oX,oY,oZ,R | : Cylinder parameters in the object frame. |
Definition at line 74 of file vpCylinder.cpp.
References vpForwardProjection::oP.
|
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 &).
cMo | : The homogeneous matrix corresponding to the pose between the camera frame and the object frame. |
Definition at line 106 of file vpForwardProjection.cpp.
References vpForwardProjection::project().
Referenced by vpPoseFeatures::addFeatureSegment(), vpPose::computeResidual(), vpProjectionDisplay::displayCamera(), vpImageDraw::drawFrame(), vpPose::poseVirtualVS(), vpPose::poseVirtualVSrobust(), vpWireFrameSimulator::projectCameraTrajectory(), vpSimulatorAfma6::updateArticularPosition(), and vpSimulatorViper850::updateArticularPosition().
|
inherited |
Feature coordinates expressed in the camera frame cP.
Definition at line 77 of file vpTracker.h.
Referenced by vpFeaturePoint3D::buildFrom(), vpSphere::changeFrame(), vpPoint::changeFrame(), vpCircle::changeFrame(), vpLine::changeFrame(), changeFrame(), vpFeatureBuilder::create(), vpPoint::get_W(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), vpSphere::init(), vpCircle::init(), vpPoint::init(), vpLine::init(), init(), vpMbtPolygon::isVisible(), vpTracker::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpSphere::projection(), vpCircle::projection(), vpPoint::projection(), vpLine::projection(), projection(), vpPoint::set_W(), vpPoint::set_X(), vpPoint::set_Y(), and vpPoint::set_Z().
|
inherited |
Flag used to indicate if the feature parameters cP expressed in the camera frame are available.
Definition at line 83 of file vpTracker.h.
Referenced by vpTracker::init(), and vpTracker::operator=().
|
inherited |
Feature coordinates expressed in the object frame.
Definition at line 228 of file vpForwardProjection.h.
Referenced by vpSphere::changeFrame(), vpPoint::changeFrame(), vpCircle::changeFrame(), vpLine::changeFrame(), changeFrame(), vpPoint::get_oW(), vpPoint::get_oX(), vpPoint::get_oY(), vpPoint::get_oZ(), vpPoint::getWorldCoordinates(), vpSphere::init(), vpCircle::init(), vpPoint::init(), vpLine::init(), init(), vpForwardProjection::print(), vpPose::printPoint(), vpPoint::set_oW(), vpPoint::set_oX(), vpPoint::set_oY(), vpPoint::set_oZ(), vpSphere::setWorldCoordinates(), vpCircle::setWorldCoordinates(), vpPoint::setWorldCoordinates(), vpLine::setWorldCoordinates(), and setWorldCoordinates().
|
inherited |
Feature coordinates expressed in the image plane p. They correspond to 2D normalized coordinates expressed in meters.
Definition at line 73 of file vpTracker.h.
Referenced by vpMbtDistanceCircle::computeInteractionMatrixError(), vpCircle::computeIntersectionPoint(), vpMeterPixelConversion::convertEllipse(), vpFeatureBuilder::create(), vpSphere::display(), vpPoint::display(), vpCircle::display(), vpLine::display(), vpProjectionDisplay::display(), display(), vpProjectionDisplay::displayCamera(), vpFeatureDisplay::displayEllipse(), vpPose::displayModel(), vpImageDraw::drawFrame(), vpPoint::get_w(), vpPoint::get_x(), vpPoint::get_y(), vpSphere::init(), vpMeTracker::init(), vpCircle::init(), vpPoint::init(), vpLine::init(), init(), vpTracker::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpSphere::projection(), vpCircle::projection(), vpPoint::projection(), vpLine::projection(), projection(), vpPoint::set_w(), vpPoint::set_x(), and vpPoint::set_y().