Visual Servoing Platform
version 3.4.0
|
#include <vpLine.h>
Public Types | |
enum | vpForwardProjectionDeallocatorType { user, vpDisplayForwardProjection } |
Public Member Functions | |
vpLine () | |
virtual | ~vpLine () |
void | changeFrame (const vpHomogeneousMatrix &cMo, vpColVector &cP) const |
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) |
vpLine * | duplicate () const |
double | getRho () const |
double | getTheta () const |
void | setRho (double rho) |
void | setTheta (double theta) |
void | setWorldCoordinates (const double &oA1, const double &oB1, const double &oC1, const double &oD1, const double &oA2, const double &oB2, const double &oC2, const double &oD2) |
void | setWorldCoordinates (const vpColVector &oP1, const vpColVector &oP2) |
void | setWorldCoordinates (const vpColVector &oP) |
void | projection () |
void | projection (const vpColVector &cP, vpColVector &p) const |
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 |
Protected Member Functions | |
void | init () |
Class that defines a 3D line in the object frame and allows forward projection of the line in the camera frame and in the 2D image plane by perspective projection. All the parameters must be set in meter.
Note that a 3D line is defined from the intersection between two 3D planes.
A 3D line has the followings parameters:
To update these line parameters you may use setWorldCoordinates(). To get theses parameters use get_oP().
It is easily possible to compute these parameters thanks to the corresponding 3D parameters oP in the object frame. But you have to note that four constraints are added in the planes equations.
To compute these parameters you may use changeFrame(). To get these parameters use get_cP().
Here and are the coordinates of a point belonging to the line in the image plane while and are the parameters used to define the line. The value of is between and and the value of can be positive or negative. The conventions used to choose the sign of and the value of are illustrated by the following image.
To compute these parameters use projection(). To get the corresponding values use get_p().
|
inherited |
Used for memory issue especially in the vpServo class.
Enumerator | |
---|---|
user | |
vpDisplayForwardProjection |
Definition at line 73 of file vpForwardProjection.h.
vpLine::vpLine | ( | ) |
Default constructor.
Definition at line 67 of file vpLine.cpp.
References init().
Referenced by duplicate().
|
inlinevirtual |
Destructor.
Definition at line 109 of file vpLine.h.
References vpForwardProjection::changeFrame(), vpForwardProjection::display(), vpForwardProjection::duplicate(), and vpColor::green.
|
virtual |
Computes the line parameters cP in the camera frame thanks to the line parameters oP given in the object frame and the homogeneous matrix relative to the pose between the camera frame and the object frame. Thus the computation gives the equations of the two planes needed to define the line in the desired frame thanks to the equations of the same two planes in the object frame.
In input of this method, the line parameters oP in the object frame are those from the vpForwardProjection::oP public attribute.
cMo | : The homogeneous matrix relative to the pose between the desired frame and the object frame. |
cP_ | : The vector which will contain the parameters of the two planes in the camera frame.
|
The code below shows how to use this method.
Implements vpForwardProjection.
Definition at line 333 of file vpLine.cpp.
References vpForwardProjection::oP, and vpColVector::resize().
Referenced by changeFrame(), vpMbtDistanceLine::computeInteractionMatrixError(), display(), vpMbtDistanceLine::initMovingEdge(), and vpMbtDistanceLine::updateMovingEdge().
|
virtual |
Computes the line parameters cP in the camera frame thanks to the line parameters oP given in the object frame and the homogeneous matrix relative to the pose cMo between the object frame and the camera frame. Thus the computation gives the equations of the two planes needed to define the line in the camera frame thanks to the equations of the same two planes in the object frame.
In input of this method, the line parameters oP in the object frame are those from the vpForwardProjection::oP public attribute.
As a result of this method, line parameters cP in the camera frame are updated in the vpTracker::cP public attribute.
cMo | : The homogeneous matrix corresponding to the pose between the camera frame and the object frame. |
The code below shows how to use this method.
Implements vpForwardProjection.
Definition at line 291 of file vpLine.cpp.
References changeFrame(), and vpTracker::cP.
|
virtual |
Displays the line in the image I thanks to the 2D parameters of the line p in the image plane (vpTracker::p) and the camera parameters which enable to convert the parameters from meter to pixel.
I | : The image where the line must be displayed. |
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 468 of file vpLine.cpp.
References vpFeatureDisplay::displayLine(), and vpTracker::p.
|
virtual |
Displays the line in the image I thanks to the parameters in the object frame (vpForwardProjection::oP), the homogeneous matrix relative to the pose between the camera frame and the object frame and the camera parameters which enable to convert the features from meter to pixel.
This method is non destructive wrt. cP and p internal line 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 496 of file vpLine.cpp.
References changeFrame(), vpFeatureDisplay::displayLine(), and projection().
|
virtual |
Create an object with the same type.
Implements vpForwardProjection.
Definition at line 520 of file vpLine.cpp.
References vpLine().
|
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.
|
inlineinherited |
Definition at line 167 of file vpForwardProjection.h.
|
inline |
Gets the value corresponding to one of the two parameters used to define the line parametrization in the image plane.
Definition at line 130 of file vpLine.h.
Referenced by vpFeatureBuilder::create(), vpMbtDistanceLine::initMovingEdge(), and vpMbtDistanceLine::updateMovingEdge().
|
inline |
Gets the angle value corresponding to one of the two parameters used to define the line parametrization in the image plane.
Definition at line 142 of file vpLine.h.
Referenced by vpFeatureBuilder::create(), vpMbtDistanceLine::initMovingEdge(), and vpMbtDistanceLine::updateMovingEdge().
|
protectedvirtual |
Initialize the memory space requested for the 2D line parameters (p) in the image plane and for 3D line parameters (oP and cP) respectively in the object frame and the camera frame.
Implements vpForwardProjection.
Definition at line 57 of file vpLine.cpp.
References vpTracker::cP, vpForwardProjection::oP, vpTracker::p, and vpColVector::resize().
Referenced by vpLine().
|
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 |
Computes the 2D parameters p of the line in the image plane thanks to the 3D line parameters cP in the camera frame located in the vpTracker::cP public attribute. The parameters are updated in the vpTracker::p public attribute.
The code below shows how to use this method.
Implements vpForwardProjection.
Definition at line 193 of file vpLine.cpp.
References vpTracker::cP, and vpTracker::p.
Referenced by vpMbtDistanceLine::computeInteractionMatrixError(), display(), vpMbtDistanceLine::initMovingEdge(), and vpMbtDistanceLine::updateMovingEdge().
|
virtual |
Computes the 2D parameters p of the line in the image plane thanks to the 3D line parameters cP expressed in the camera frame. The image plane parameters are updated in output.
[in] | cP_ | : The vector containing the line parameters relative to the camera frame.
|
[out] | p_ | : The vector which contains the 2D line features expressed in the image plane.
|
vpException::fatalError | : Degenerate case, the image of the straight line is a point. |
Implements vpForwardProjection.
Definition at line 216 of file vpLine.cpp.
References vpTracker::cP, vpException::dimensionError, vpException::fatalError, vpArray2D< Type >::getRows(), and vpColVector::resize().
|
inlineinherited |
Definition at line 196 of file vpForwardProjection.h.
References vpTracker::init().
|
inline |
Sets the parameter used to define the line in the image plane.
rho | : The desired value for . |
|
inline |
Sets the angle value used to define the line in the image plane.
theta | : The desired value for angle. |
Definition at line 163 of file vpLine.h.
References vpForwardProjection::init(), vpForwardProjection::projection(), and vpForwardProjection::setWorldCoordinates().
void vpLine::setWorldCoordinates | ( | const double & | oA1, |
const double & | oB1, | ||
const double & | oC1, | ||
const double & | oD1, | ||
const double & | oA2, | ||
const double & | oB2, | ||
const double & | oC2, | ||
const double & | oD2 | ||
) |
Sets the parameters oP which define the line in the object frame. As said in the class description, the line is defined as the intersection of two planes. The different parameters here define the equations of the two planes in the object frame. They are used to set the vpForwardProjection::oP public attribute.
Here are the 3D coordinates of a point in the object frame.
oA1,oB1,oC1,oD1 | : The parameters used to define the first plane in the object frame. |
oA2,oB2,oC2,oD2 | : The parameters used to define the second plane in the object frame. |
Definition at line 85 of file vpLine.cpp.
References vpForwardProjection::oP.
Referenced by vpMbtDistanceLine::~vpMbtDistanceLine().
void vpLine::setWorldCoordinates | ( | const vpColVector & | oP1, |
const vpColVector & | oP2 | ||
) |
Sets the parameters oP which define the line in the object frame. As said in the class description, the line is defined as the intersection of two planes. Eight parameters are required to define the equations of the two planes in the object frame. They are used to set the vpForwardProjection::oP public attribute.
Here are the 3D coordinates of a point in the object frame.
oP1 | : The column vector which contains the four parameters needed to define the equations of the first plane in the object frame.
|
oP2 | : The column vector which contains the four parameters needed to define the equations of the second plane in the object frame.
|
Definition at line 146 of file vpLine.cpp.
References vpException::dimensionError, vpArray2D< Type >::getRows(), and vpForwardProjection::oP.
|
virtual |
Sets the parameters oP which define the line in the object frame. As said in the class description, the line is defined as the intersection of two planes. Eight parameters are required to define the equations of the two planes in the object frame. They are used to set the vpForwardProjection::oP public attribute.
Here are the 3D coordinates of a point in the object frame.
oP_ | : The column vector which contains the eight parameters needed to define the equations of the two planes in the object frame.
|
Implements vpForwardProjection.
Definition at line 117 of file vpLine.cpp.
References vpException::dimensionError, vpArray2D< Type >::getRows(), and 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(), changeFrame(), vpCylinder::changeFrame(), vpFeatureBuilder::create(), vpPoint::get_W(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), vpSphere::init(), vpCircle::init(), vpPoint::init(), init(), vpCylinder::init(), vpMbtPolygon::isVisible(), vpTracker::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpSphere::projection(), vpCircle::projection(), vpPoint::projection(), projection(), vpCylinder::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(), changeFrame(), vpCylinder::changeFrame(), vpPoint::get_oW(), vpPoint::get_oX(), vpPoint::get_oY(), vpPoint::get_oZ(), vpPoint::getWorldCoordinates(), vpSphere::init(), vpCircle::init(), vpPoint::init(), init(), vpCylinder::init(), vpForwardProjection::print(), vpPose::printPoint(), vpCircle::projection(), vpPoint::set_oW(), vpPoint::set_oX(), vpPoint::set_oY(), vpPoint::set_oZ(), vpSphere::setWorldCoordinates(), vpCircle::setWorldCoordinates(), vpPoint::setWorldCoordinates(), setWorldCoordinates(), and vpCylinder::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(), display(), vpProjectionDisplay::display(), vpCylinder::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(), init(), vpCylinder::init(), vpTracker::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpSphere::projection(), vpCircle::projection(), vpPoint::projection(), projection(), vpCylinder::projection(), vpPoint::set_w(), vpPoint::set_x(), and vpPoint::set_y().