Visual Servoing Platform
version 3.5.1 under development (2023-09-22)
|
#include <visp3/me/vpMeNurbs.h>
Public Member Functions | |
vpMeNurbs () | |
vpMeNurbs (const vpMeNurbs &menurbs) | |
virtual | ~vpMeNurbs () |
void | setNbControlPoints (unsigned int nb_point) |
void | setEnableCannyDetection (const bool enable_canny) |
void | setCannyThreshold (float th1, float th2) |
void | initTracking (const vpImage< unsigned char > &I) |
void | initTracking (const vpImage< unsigned char > &I, const std::list< vpImagePoint > &ptList) |
void | track (const vpImage< unsigned char > &I) |
virtual void | sample (const vpImage< unsigned char > &I, bool doNotTrack=false) |
void | reSample (const vpImage< unsigned char > &I) |
void | updateDelta () |
void | setExtremities () |
void | seekExtremities (const vpImage< unsigned char > &I) |
void | seekExtremitiesCanny (const vpImage< unsigned char > &I) |
void | suppressPoints () |
void | supressNearPoints () |
void | localReSample (const vpImage< unsigned char > &I) |
vpNurbs | getNurbs () const |
void | display (const vpImage< unsigned char > &I, const vpColor &color, unsigned int thickness=1) |
Public Member Functions Inherited from vpTracker | |
vpColVector | get_p () const |
vpColVector | get_cP () const |
Static Public Member Functions | |
static void | display (const vpImage< unsigned char > &I, vpNurbs &n, const vpColor &color=vpColor::green, unsigned int thickness=1) |
static void | display (const vpImage< vpRGBa > &I, vpNurbs &n, const vpColor &color=vpColor::green, unsigned int thickness=1) |
Public Attributes | |
vpNurbs | nurbs |
Public Attributes Inherited from vpMeTracker | |
std::list< vpMeSite > | list |
vpMe * | me |
unsigned int | init_range |
int | nGoodElement |
const vpImage< bool > * | m_mask |
int | query_range |
bool | display_point |
Public Attributes Inherited from vpTracker | |
vpColVector | p |
vpColVector | cP |
bool | cPAvailable |
Protected Attributes | |
Protected Attributes Inherited from vpMeTracker | |
vpMeSite::vpMeSiteDisplayType | selectDisplay |
Public Member Functions Inherited from vpMeTracker | |
void | display (const vpImage< unsigned char > &I) |
void | display (const vpImage< vpRGBa > &I) |
void | display (const vpImage< unsigned char > &I, vpColVector &w, unsigned int &index_w) |
unsigned int | getInitRange () |
vpMe * | getMe () |
std::list< vpMeSite > & | getMeList () |
std::list< vpMeSite > | getMeList () const |
int | getNbPoints () const |
void | init () |
unsigned int | numberOfSignal () |
int | outOfImage (int i, int j, int half, int row, int cols) |
int | outOfImage (const vpImagePoint &iP, int half, int rows, int cols) |
void | reset () |
void | setDisplay (vpMeSite::vpMeSiteDisplayType select) |
void | setInitRange (const unsigned int &r) |
virtual void | setMask (const vpImage< bool > &mask) |
void | setMe (vpMe *p_me) |
void | setMeList (const std::list< vpMeSite > &l) |
unsigned int | totalNumberOfSignal () |
static bool | inMask (const vpImage< bool > *mask, unsigned int i, unsigned int j) |
Class that tracks in an image a edge defined by a Nurbs.
The advantage of this class is that it enables to track an edge whose equation is not known in advance. At each iteration, the Nurbs corresponding to the edge is computed.
It is possible to have a direct access to the nurbs. It is indeed a public parameter.
The code below shows how to use this class.
Definition at line 128 of file vpMeNurbs.h.
vpMeNurbs::vpMeNurbs | ( | ) |
Basic constructor that calls the constructor of the class vpMeTracker.
Definition at line 204 of file vpMeNurbs.cpp.
vpMeNurbs::vpMeNurbs | ( | const vpMeNurbs & | menurbs | ) |
Copy constructor.
Definition at line 209 of file vpMeNurbs.cpp.
|
virtual |
Destructor.
Definition at line 222 of file vpMeNurbs.cpp.
|
inherited |
Display the moving edge sites with a color corresponding to their state.
I | : The image. |
Definition at line 229 of file vpMeTracker.cpp.
References vpMeSite::display(), and vpMeTracker::list.
Referenced by vpMeTracker::display(), vpMeEllipse::initTracking(), vpMeEllipse::track(), and vpMeLine::track().
void vpMeNurbs::display | ( | const vpImage< unsigned char > & | I, |
const vpColor & | color, | ||
unsigned int | thickness = 1 |
||
) |
Display edge.
I | : Image in which the edge appears. |
color | : Color of the displayed line. |
thickness | : Drawings thickness. |
Definition at line 900 of file vpMeNurbs.cpp.
References nurbs.
|
inherited |
Displays the status of moving edge sites
I | : The image. |
w | : vector |
index_w | : index |
Definition at line 245 of file vpMeTracker.cpp.
References vpMeTracker::display(), vpMeSite::getState(), vpMeTracker::list, vpMeSite::NO_SUPPRESSION, and vpMeSite::weight.
|
static |
Display of a moving nurbs.
I | : The image used as background. |
n | : Nurbs to display |
color | : Color used to display the nurbs. |
thickness | : Drawings thickness. |
Definition at line 1119 of file vpMeNurbs.cpp.
References vpNurbs::computeCurvePoint(), and vpDisplay::displayCross().
Display the moving edge sites with a color corresponding to their state.
I | : The image. |
Definition at line 237 of file vpMeTracker.cpp.
References vpMeSite::display(), and vpMeTracker::list.
|
static |
Display of a moving nurbs.
I | : The image used as background. |
n | : Nurbs to display |
color | : Color used to display the nurbs. |
thickness | : Drawings thickness. |
Definition at line 1130 of file vpMeNurbs.cpp.
References vpNurbs::computeCurvePoint(), and vpDisplay::displayCross().
|
inlineinherited |
Return object parameters expressed in the 3D camera frame.
Definition at line 94 of file vpTracker.h.
|
inlineinherited |
Return object parameters expressed in the 2D image plane computed by perspective projection.
Definition at line 92 of file vpTracker.h.
|
inlineinherited |
|
inlineinherited |
Return the moving edges initialisation parameters.
Definition at line 168 of file vpMeTracker.h.
|
inlineinherited |
Return the list of moving edges
Definition at line 175 of file vpMeTracker.h.
|
inlineinherited |
Return the list of moving edges
Definition at line 182 of file vpMeTracker.h.
|
inlineinherited |
Return the number of points that has not been suppressed.
Definition at line 189 of file vpMeTracker.h.
|
inline |
Gets the nurbs;
Definition at line 307 of file vpMeNurbs.h.
|
inherited |
Initialize the tracker.
Definition at line 50 of file vpMeTracker.cpp.
References vpTracker::init(), vpMeSite::NONE, vpTracker::p, vpColVector::resize(), and vpMeTracker::selectDisplay.
Referenced by vpMeTracker::vpMeTracker().
void vpMeNurbs::initTracking | ( | const vpImage< unsigned char > & | I | ) |
Initialization of the tracking. Ask the user to click left on several points along the edge to track and click right at the end.
I | : Image in which the edge appears. |
Definition at line 224 of file vpMeNurbs.cpp.
References vpMouseButton::button1, vpMouseButton::button3, vpDisplay::displayCross(), vpDisplay::flush(), vpDisplay::getClick(), vpColor::green, and vpException::notInitialized.
void vpMeNurbs::initTracking | ( | const vpImage< unsigned char > & | I, |
const std::list< vpImagePoint > & | ptList | ||
) |
Initialization of the tracking. The Nurbs is initialized thanks to the list of vpImagePoint.
I | : Image in which the edge appears. |
ptList | : List of point to initialize the Nurbs. |
Definition at line 246 of file vpMeNurbs.cpp.
References vpNurbs::globalCurveInterp(), vpMeTracker::initTracking(), nurbs, sample(), and track().
|
staticinherited |
Test whether the pixel is inside the mask. Mask values that are set to true are considered in the tracking.
mask | Mask image or NULL if not wanted. Mask values that are set to true are considered in the tracking. To disable a pixel, set false. |
i | : Pixel coordinate along the rows. |
j | : Pixel coordinate along the columns. |
Definition at line 123 of file vpMeTracker.cpp.
References vpImage< Type >::getValue().
Referenced by vpMbtFaceDepthDense::computeDesiredFeatures(), vpMbtFaceDepthNormal::computeDesiredFeatures(), vpMbtDistanceKltPoints::computeNbDetectedCurrent(), vpMbtDistanceKltPoints::init(), and vpMeTracker::track().
void vpMeNurbs::localReSample | ( | const vpImage< unsigned char > & | I | ) |
Resample a part of the edge if two vpMeSite are too far from each other. In this case the method try to initialize any vpMeSite between the two points.
I | : Image in which the edge appears. |
Definition at line 724 of file vpMeNurbs.cpp.
References vpNurbs::computeCurveDersPoint(), vpNurbs::computeCurvePoint(), vpImage< Type >::getHeight(), vpMe::getPointsToTrack(), vpMe::getRange(), vpMe::getSampleStep(), vpMeSite::getState(), vpImage< Type >::getWidth(), vpMeSite::ifloat, vpMeSite::init(), vpMeSite::jfloat, vpMeTracker::list, vpMath::maximum(), vpMeTracker::me, vpMeSite::NO_SUPPRESSION, vpMeTracker::numberOfSignal(), nurbs, vpMeTracker::outOfImage(), vpMeTracker::selectDisplay, vpMeSite::setDisplay(), vpMe::setRange(), vpMath::sqr(), vpImagePoint::sqrDistance(), vpMeSite::sqrDistance(), and vpMeSite::track().
Referenced by track().
|
inherited |
Return number of moving-edges that are tracked.
Definition at line 112 of file vpMeTracker.cpp.
References vpMeTracker::list.
Referenced by vpMeLine::leastSquare(), vpMeEllipse::leastSquareRobust(), localReSample(), vpMeLine::reSample(), and reSample().
|
inherited |
Check if a pixel i,j is out of the image.
Definition at line 138 of file vpMeTracker.cpp.
References vpImagePoint::get_i(), vpImagePoint::get_j(), and vpMath::round().
|
inherited |
Check if a pixel i,j is out of the image.
Definition at line 133 of file vpMeTracker.cpp.
Referenced by localReSample(), vpMeEllipse::plugHoles(), sample(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeLine::seekExtremities(), and seekExtremities().
void vpMeNurbs::reSample | ( | const vpImage< unsigned char > & | I | ) |
Resample the edge if the number of sample is less than 70% of the expected value.
I | : Image in which the edge appears. |
Definition at line 713 of file vpMeNurbs.cpp.
References vpMe::getSampleStep(), vpMeTracker::initTracking(), vpMeTracker::me, vpMeTracker::numberOfSignal(), and sample().
Referenced by track().
|
inherited |
Reset the tracker by removing all the moving edges.
Definition at line 88 of file vpMeTracker.cpp.
References vpMeTracker::list, and vpMeTracker::nGoodElement.
Referenced by vpMeTracker::~vpMeTracker().
|
virtual |
Construct a list of vpMeSite moving edges at a particular sampling step between the two extremities of the nurbs.
I | : Image in which the edge appears. |
doNotTrack | : Inherited parameter, not used. |
Implements vpMeTracker.
Definition at line 256 of file vpMeNurbs.cpp.
References vpNurbs::computeCurveDersPoint(), vpImage< Type >::getHeight(), vpMe::getPointsToTrack(), vpMe::getSampleStep(), vpImage< Type >::getWidth(), vpMeSite::init(), vpMeTracker::list, vpMeTracker::me, nurbs, vpMeTracker::outOfImage(), vpMeTracker::selectDisplay, vpMeSite::setDisplay(), vpMath::sqr(), and vpImagePoint::sqrDistance().
Referenced by initTracking(), and reSample().
void vpMeNurbs::seekExtremities | ( | const vpImage< unsigned char > & | I | ) |
Seek along the edge defined by the nurbs, the two extremities of the edge. This function is useful in case of translation of the edge.
I | : Image in which the edge appears. |
Definition at line 341 of file vpMeNurbs.cpp.
References vpMath::abs(), vpColor::blue, vpNurbs::computeCurveDersPoint(), vpDisplay::displayCross(), vpImagePoint::distance(), vpImage< Type >::getHeight(), vpMe::getRange(), vpMe::getSampleStep(), vpMeSite::getState(), vpImage< Type >::getWidth(), vpMeSite::i, vpMeSite::ifloat, vpMeSite::init(), vpMeSite::j, vpMeSite::jfloat, vpMeTracker::list, vpMeTracker::me, vpMeSite::NO_SUPPRESSION, nurbs, vpMeTracker::outOfImage(), vpMeTracker::selectDisplay, vpImagePoint::set_ij(), vpMeSite::setDisplay(), vpMe::setRange(), vpMath::sign(), vpMeSite::track(), and vpDEBUG_ENABLE.
Referenced by track().
void vpMeNurbs::seekExtremitiesCanny | ( | const vpImage< unsigned char > & | I | ) |
Seek the extremities of the edge thanks to a canny edge detection. The edge detection enable to find the points belonging to the edge. The any vpMeSite are initialized at this points.
This method is useful when the edge is not smooth.
I | : Image in which the edge appears. |
Definition at line 451 of file vpMeNurbs.cpp.
References vpImageFilter::canny(), vpNurbs::computeCurveDersPoint(), vpNurbs::computeCurvePoint(), vpImageTools::crop(), vpDisplay::displayPoint(), vpDisplay::displayRectangle(), vpImagePoint::get_i(), vpImagePoint::get_j(), vpImage< Type >::getHeight(), vpMe::getRange(), vpMe::getSampleStep(), vpImage< Type >::getWidth(), vpColor::green, vpMeSite::ifloat, vpMeSite::init(), vpMeSite::jfloat, vpMeTracker::list, vpMath::maximum(), vpMeTracker::me, nurbs, vpColor::orange, vpMeTracker::selectDisplay, vpMeSite::setDisplay(), vpMe::setRange(), vpMath::sqr(), vpMeSite::sqrDistance(), and vpMeSite::track().
Referenced by track().
|
inline |
Enables to set the two thresholds use by the canny detection.
th1 | : The first threshold; |
th2 | : The second threshold; |
Definition at line 194 of file vpMeNurbs.h.
|
inlineinherited |
Set type of moving-edges display.
select | : Display type selector. |
Definition at line 238 of file vpMeTracker.h.
|
inline |
Enables or disables the canny detection used during the extremities search.
enable_canny | : if true it enables the canny detection. |
Definition at line 186 of file vpMeNurbs.h.
void vpMeNurbs::setExtremities | ( | ) |
Seek along the edge defined by the nurbs, the two extremities of the edge. This function is useful in case of translation of the edge.
|
inlineinherited |
|
inlinevirtualinherited |
|
inlineinherited |
Set the moving edges initialisation parameters.
p_me | : Moving Edges. |
Definition at line 259 of file vpMeTracker.h.
|
inlineinherited |
Set the list of moving edges.
l | : list of Moving Edges. |
Definition at line 266 of file vpMeTracker.h.
|
inline |
Sets the number of control points used to compute the Nurbs.
nb_point | : The number of control points used to compute the Nurbs. |
Definition at line 178 of file vpMeNurbs.h.
void vpMeNurbs::suppressPoints | ( | ) |
Suppression of the points which:
Definition at line 291 of file vpMeNurbs.cpp.
References vpMeSite::getState(), vpMeTracker::list, and vpMeSite::NO_SUPPRESSION.
Referenced by track().
void vpMeNurbs::supressNearPoints | ( | ) |
Suppress vpMeSites if they are too close to each other.
The goal is to keep the order of the vpMeSites in the list.
Definition at line 809 of file vpMeNurbs.cpp.
References vpMe::getSampleStep(), vpMeTracker::list, vpMeTracker::me, vpMeSite::setState(), vpMath::sqr(), vpMeSite::sqrDistance(), and vpMeSite::TOO_NEAR.
Referenced by track().
|
inherited |
Return the total number of moving-edges.
Definition at line 121 of file vpMeTracker.cpp.
References vpMeTracker::list.
void vpMeNurbs::track | ( | const vpImage< unsigned char > & | I | ) |
Track the edge in the image I.
I | : Image in which the edge appears. |
Definition at line 854 of file vpMeNurbs.cpp.
References vpNurbs::computeCurvePoint(), vpImagePoint::distance(), vpNurbs::globalCurveApprox(), vpMeTracker::list, localReSample(), vpTrackingException::notEnoughPointError, nurbs, reSample(), seekExtremities(), seekExtremitiesCanny(), suppressPoints(), supressNearPoints(), vpMeTracker::track(), and updateDelta().
Referenced by initTracking().
void vpMeNurbs::updateDelta | ( | ) |
Set the alpha value (normal to the edge at this point) of the different vpMeSite to a value computed thanks to the nurbs.
Definition at line 304 of file vpMeNurbs.cpp.
References vpMeSite::alpha, vpNurbs::computeCurveDersPoint(), vpNurbs::computeCurvePoint(), vpImagePoint::distance(), vpMeSite::i, vpMeSite::j, vpMeTracker::list, and nurbs.
Referenced by track().
|
inherited |
Feature coordinates expressed in the camera frame cP.
Definition at line 72 of file vpTracker.h.
Referenced by vpFeaturePoint3D::buildFrom(), vpCircle::changeFrame(), vpCylinder::changeFrame(), vpLine::changeFrame(), vpPoint::changeFrame(), vpSphere::changeFrame(), vpFeatureBuilder::create(), vpPoint::get_W(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), vpCircle::init(), vpCylinder::init(), vpLine::init(), vpPoint::init(), vpSphere::init(), vpMbtPolygon::isVisible(), vpTracker::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpCircle::projection(), vpCylinder::projection(), vpLine::projection(), vpPoint::projection(), vpSphere::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 78 of file vpTracker.h.
Referenced by vpTracker::init(), and vpTracker::operator=().
|
inherited |
Definition at line 288 of file vpMeTracker.h.
Referenced by vpMeTracker::operator=(), and vpMeTracker::vpMeTracker().
|
inherited |
Initial range.
Definition at line 76 of file vpMeTracker.h.
Referenced by vpMeTracker::initTracking(), vpMeTracker::operator=(), and vpMeTracker::vpMeTracker().
|
inherited |
Tracking dependent variables/functions List of tracked moving edges points.
Definition at line 72 of file vpMeTracker.h.
Referenced by vpMeTracker::display(), vpMeLine::display(), vpMeTracker::initTracking(), vpMeLine::leastSquare(), vpMeEllipse::leastSquareRobust(), localReSample(), vpMeTracker::numberOfSignal(), vpMeTracker::operator=(), vpMeEllipse::plugHoles(), vpMeTracker::reset(), sample(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeLine::seekExtremities(), seekExtremities(), seekExtremitiesCanny(), vpMeLine::setExtremities(), vpMeLine::suppressPoints(), suppressPoints(), supressNearPoints(), vpMeTracker::totalNumberOfSignal(), track(), vpMeTracker::track(), vpMeLine::updateDelta(), updateDelta(), vpMeEllipse::updateTheta(), vpMeTracker::vpMeTracker(), vpMeEllipse::~vpMeEllipse(), and vpMeLine::~vpMeLine().
|
inherited |
Mask used to disable tracking on a part of image.
Definition at line 80 of file vpMeTracker.h.
Referenced by vpMeTracker::track().
|
inherited |
Moving edges initialisation parameters.
Definition at line 74 of file vpMeTracker.h.
Referenced by vpMeTracker::initTracking(), vpMeEllipse::leastSquareRobust(), localReSample(), vpMeTracker::operator=(), vpMeEllipse::plugHoles(), vpMeLine::reSample(), reSample(), sample(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeLine::seekExtremities(), seekExtremities(), seekExtremitiesCanny(), supressNearPoints(), vpMeTracker::track(), and vpMeTracker::vpMeTracker().
|
inherited |
Number of good moving-edges that are tracked.
Definition at line 78 of file vpMeTracker.h.
Referenced by vpMeTracker::initTracking(), vpMeTracker::operator=(), vpMeTracker::reset(), vpMeTracker::track(), and vpMeTracker::vpMeTracker().
vpNurbs vpMeNurbs::nurbs |
The Nurbs which represents the tracked edge.
Definition at line 136 of file vpMeNurbs.h.
Referenced by display(), initTracking(), localReSample(), sample(), seekExtremities(), seekExtremitiesCanny(), track(), and updateDelta().
|
inherited |
Feature coordinates expressed in the image plane p. They correspond to 2D normalized coordinates expressed in meters.
Definition at line 68 of file vpTracker.h.
Referenced by vpMbtDistanceCircle::computeInteractionMatrixError(), vpCircle::computeIntersectionPoint(), vpMeterPixelConversion::convertEllipse(), vpFeatureBuilder::create(), vpCircle::display(), vpCylinder::display(), vpLine::display(), vpPoint::display(), vpSphere::display(), vpProjectionDisplay::display(), vpProjectionDisplay::displayCamera(), vpFeatureDisplay::displayEllipse(), vpPose::displayModel(), vpImageDraw::drawFrame(), vpPoint::get_w(), vpPoint::get_x(), vpPoint::get_y(), vpCircle::init(), vpCylinder::init(), vpLine::init(), vpPoint::init(), vpSphere::init(), vpMeTracker::init(), vpTracker::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpCircle::projection(), vpCylinder::projection(), vpLine::projection(), vpPoint::projection(), vpSphere::projection(), vpPoint::set_w(), vpPoint::set_x(), and vpPoint::set_y().
|
inherited |
Definition at line 287 of file vpMeTracker.h.
Referenced by vpMeTracker::operator=(), and vpMeTracker::vpMeTracker().
|
protectedinherited |
Definition at line 86 of file vpMeTracker.h.
Referenced by vpMeTracker::init(), localReSample(), vpMeTracker::operator=(), vpMeEllipse::plugHoles(), sample(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeLine::seekExtremities(), seekExtremities(), seekExtremitiesCanny(), and vpMeTracker::vpMeTracker().