Visual Servoing Platform
version 3.6.1 under development (2024-11-15)
|
#include <visp3/me/vpMeNurbs.h>
Public Member Functions | |
vpMeNurbs () | |
vpMeNurbs (const vpMeNurbs &menurbs) | |
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 | 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 | |
Public Attributes Inherited from vpTracker | |
vpColVector | p |
vpColVector | cP |
bool | cPAvailable |
Protected Attributes | |
Protected Attributes Inherited from vpMeTracker | |
std::list< vpMeSite > | m_meList |
vpMe * | m_me |
unsigned int | m_init_range |
int | m_nGoodElement |
const vpImage< bool > * | m_mask |
const vpImage< bool > * | m_maskCandidates |
vpMeSite::vpMeSiteDisplayType | m_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 () |
bool | outOfImage (int i, int j, int border, int nrows, int ncols) |
bool | outOfImage (const vpImagePoint &iP, int border, int nrows, int ncols) |
void | reset () |
void | setDisplay (vpMeSite::vpMeSiteDisplayType select) |
void | setInitRange (const unsigned int &r) |
virtual void | setMask (const vpImage< bool > &mask) |
virtual void | setMaskCandidates (const vpImage< bool > *maskCandidates) |
void | setMe (vpMe *me) |
void | setMeList (const std::list< vpMeSite > &meList) |
unsigned int | totalNumberOfSignal () |
static bool | inRoiMask (const vpImage< bool > *mask, unsigned int i, unsigned int j) |
static bool | inMeMaskCandidates (const vpImage< bool > *meMaskCandidates, 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 132 of file vpMeNurbs.h.
vpMeNurbs::vpMeNurbs | ( | ) |
Basic constructor that calls the constructor of the class vpMeTracker.
Definition at line 184 of file vpMeNurbs.cpp.
vpMeNurbs::vpMeNurbs | ( | const vpMeNurbs & | menurbs | ) |
Copy constructor.
Definition at line 189 of file vpMeNurbs.cpp.
|
inherited |
Display the moving edge sites with a color corresponding to their state.
I | : The image. |
Definition at line 254 of file vpMeTracker.cpp.
References vpMeSite::display(), and vpMeTracker::m_meList.
Referenced by vpMeTracker::display(), vpMeEllipse::initTracking(), 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 858 of file vpMeNurbs.cpp.
|
inherited |
Displays the status of moving edge sites
I | : The image. |
w | : vector |
index_w | : index |
Definition at line 272 of file vpMeTracker.cpp.
References vpMeTracker::display(), vpMeSite::getState(), vpMeTracker::m_meList, vpMeSite::NO_SUPPRESSION, and vpMeSite::setWeight().
|
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 1077 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 263 of file vpMeTracker.cpp.
References vpMeSite::display(), and vpMeTracker::m_meList.
|
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 1088 of file vpMeNurbs.cpp.
References vpNurbs::computeCurvePoint(), and vpDisplay::displayCross().
|
inlineinherited |
Return object parameters expressed in the 3D camera frame.
Definition at line 95 of file vpTracker.h.
|
inlineinherited |
Return object parameters expressed in the 2D image plane computed by perspective projection.
Definition at line 93 of file vpTracker.h.
|
inlineinherited |
|
inlineinherited |
Return the moving edges initialisation parameters.
Definition at line 153 of file vpMeTracker.h.
|
inlineinherited |
Return the list of moving edges
Definition at line 160 of file vpMeTracker.h.
|
inlineinherited |
Return the list of moving edges
Definition at line 167 of file vpMeTracker.h.
|
inlineinherited |
Return the number of points that has not been suppressed.
Definition at line 174 of file vpMeTracker.h.
|
inline |
Gets the nurbs;
Definition at line 299 of file vpMeNurbs.h.
|
inherited |
Initialize the tracker.
Definition at line 48 of file vpMeTracker.cpp.
References vpTracker::init(), vpMeTracker::m_selectDisplay, vpMeSite::NONE, vpTracker::p, and vpColVector::resize().
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 202 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 224 of file vpMeNurbs.cpp.
References vpNurbs::globalCurveInterp(), vpMeTracker::initTracking(), sample(), and track().
|
staticinherited |
Test whether the moving-edge (ME) is inside the mask of ME candidates for the initialization. Mask values that are set to true and their 8 neighbors are considered for the initialization.
meMaskCandidates | Mask corresponding the ME location in the image or nullptr if not wanted. Mask values that are set to true are considered for the initialization. To disable a pixel, set false. |
i | : ME coordinate along the rows. |
j | : ME coordinate along the columns. |
Definition at line 115 of file vpMeTracker.cpp.
References vpImage< Type >::getCols(), and vpImage< Type >::getRows().
Referenced by vpMeEllipse::sample(), vpMeLine::sample(), and vpMeLine::seekExtremities().
|
staticinherited |
Test whether the pixel is inside the region of interest mask. Mask values that are set to true are considered in the tracking.
mask | Mask corresponding to the region of interest in the image or nullptr 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 105 of file vpMeTracker.cpp.
References vpImage< Type >::getValue().
Referenced by vpMbtFaceDepthDense::computeDesiredFeatures(), vpMbtFaceDepthNormal::computeDesiredFeatures(), vpMeEllipse::plugHoles(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeLine::seekExtremities(), 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 701 of file vpMeNurbs.cpp.
References vpNurbs::computeCurveDersPoint(), vpNurbs::computeCurvePoint(), vpImage< Type >::getHeight(), vpMe::getPointsToTrack(), vpMe::getRange(), vpMe::getSampleStep(), vpMeSite::getState(), vpImage< Type >::getWidth(), vpMeSite::init(), vpMeSite::m_ifloat, vpMeSite::m_jfloat, vpMeTracker::m_me, vpMeTracker::m_meList, vpMeTracker::m_selectDisplay, vpMath::maximum(), vpMeSite::NO_SUPPRESSION, vpMeTracker::numberOfSignal(), vpMeTracker::outOfImage(), 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 94 of file vpMeTracker.cpp.
References vpMeTracker::m_meList.
Referenced by vpMeLine::leastSquare(), vpMeEllipse::leastSquareRobust(), vpMeEllipse::leastSquareRobustCircle(), vpMeEllipse::leastSquareRobustEllipse(), localReSample(), vpMeLine::reSample(), and reSample().
|
inherited |
Check if a pixel i,j is out of the image.
[in] | iP | : Pixel coordinates. |
[in] | border | : Number of pixels along the image border to exclude. When border is set to 0, consider the complete image. |
[in] | nrows,ncols | : Size of the image. |
Definition at line 174 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.
[in] | i,j | : Pixel coordinates. |
[in] | border | : Number of pixels along the image border to exclude. When border is set to 0, consider the complete image. |
[in] | nrows,ncols | : Size of the image. |
Definition at line 166 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 690 of file vpMeNurbs.cpp.
References vpMe::getSampleStep(), vpMeTracker::initTracking(), vpMeTracker::m_me, vpMeTracker::numberOfSignal(), and sample().
Referenced by track().
|
inherited |
Reset the tracker by removing all the moving edges.
Definition at line 74 of file vpMeTracker.cpp.
References vpMeTracker::m_meList, and vpMeTracker::m_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 234 of file vpMeNurbs.cpp.
References vpNurbs::computeCurveDersPoint(), vpImage< Type >::getHeight(), vpMe::getPointsToTrack(), vpMe::getSampleStep(), vpImage< Type >::getWidth(), vpMeSite::init(), vpMeTracker::m_me, vpMeTracker::m_meList, vpMeTracker::m_selectDisplay, vpMeTracker::outOfImage(), 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 319 of file vpMeNurbs.cpp.
References vpMath::abs(), vpColor::blue, vpNurbs::computeCurveDersPoint(), vpDisplay::displayCross(), vpImagePoint::distance(), vpMeSite::get_i(), vpMeSite::get_j(), vpImage< Type >::getHeight(), vpMe::getRange(), vpMe::getSampleStep(), vpMeSite::getState(), vpImage< Type >::getWidth(), vpMeSite::init(), vpMeSite::m_i, vpMeSite::m_ifloat, vpMeSite::m_j, vpMeSite::m_jfloat, vpMeTracker::m_me, vpMeTracker::m_meList, vpMeTracker::m_selectDisplay, vpMeSite::NO_SUPPRESSION, vpMeTracker::outOfImage(), vpImagePoint::set_ij(), vpMeSite::setDisplay(), vpMe::setRange(), vpMath::sign(), and vpMeSite::track().
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 429 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::init(), vpMeSite::m_ifloat, vpMeSite::m_jfloat, vpMeTracker::m_me, vpMeTracker::m_meList, vpMeTracker::m_selectDisplay, vpMath::maximum(), vpColor::orange, 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 193 of file vpMeNurbs.h.
|
inlineinherited |
Set type of moving-edges display.
select | : Display type selector. |
Definition at line 232 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 185 of file vpMeNurbs.h.
|
inlineinherited |
|
inlinevirtualinherited |
|
inlinevirtualinherited |
Set the mask of candidates points for initialization.
maskCandidates | : Pointer towards the mask of candidates points for initialization. |
Definition at line 253 of file vpMeTracker.h.
|
inlineinherited |
Set the moving edges initialisation parameters.
me | : Moving Edges. |
Definition at line 260 of file vpMeTracker.h.
|
inlineinherited |
Set the list of moving edges.
meList | : List of Moving Edges. |
Definition at line 267 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 177 of file vpMeNurbs.h.
void vpMeNurbs::suppressPoints | ( | ) |
Suppression of the points which:
Definition at line 269 of file vpMeNurbs.cpp.
References vpMeSite::getState(), vpMeTracker::m_meList, 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 785 of file vpMeNurbs.cpp.
References vpMe::getSampleStep(), vpMeTracker::m_me, vpMeTracker::m_meList, vpMeSite::setState(), vpMath::sqr(), vpMeSite::sqrDistance(), and vpMeSite::TOO_NEAR.
Referenced by track().
|
inherited |
Return the total number of moving-edges.
Definition at line 103 of file vpMeTracker.cpp.
References vpMeTracker::m_meList.
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 812 of file vpMeNurbs.cpp.
References vpNurbs::computeCurvePoint(), vpImagePoint::distance(), vpNurbs::globalCurveApprox(), localReSample(), vpMeTracker::m_meList, vpTrackingException::notEnoughPointError, 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 282 of file vpMeNurbs.cpp.
References vpNurbs::computeCurveDersPoint(), vpNurbs::computeCurvePoint(), vpImagePoint::distance(), vpMeSite::get_i(), vpMeSite::get_j(), vpMeTracker::m_meList, and vpMeSite::setAlpha().
Referenced by track().
|
inherited |
Feature coordinates expressed in the camera frame cP.
Definition at line 73 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 79 of file vpTracker.h.
Referenced by vpTracker::init(), and vpTracker::operator=().
|
protectedinherited |
Initial range.
Definition at line 315 of file vpMeTracker.h.
Referenced by vpMeTracker::initTracking(), vpMeTracker::operator=(), and vpMeTracker::vpMeTracker().
|
protectedinherited |
Mask used to disable tracking on a part of image.
Definition at line 319 of file vpMeTracker.h.
Referenced by vpMeEllipse::plugHoles(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeLine::seekExtremities(), and vpMeTracker::track().
|
protectedinherited |
Mask used to determine candidate points for initialization in an image.
Definition at line 321 of file vpMeTracker.h.
Referenced by vpMeEllipse::sample(), vpMeLine::sample(), and vpMeLine::seekExtremities().
|
protectedinherited |
Moving edges initialisation parameters.
Definition at line 313 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().
|
protectedinherited |
Tracking dependent variables/functions List of tracked moving edges points.
Definition at line 311 of file vpMeTracker.h.
Referenced by vpMeTracker::display(), vpMeLine::display(), vpMeTracker::initTracking(), vpMeLine::leastSquare(), vpMeEllipse::leastSquareRobust(), vpMeEllipse::leastSquareRobustCircle(), vpMeEllipse::leastSquareRobustEllipse(), 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().
|
protectedinherited |
Number of good moving-edges that are tracked.
Definition at line 317 of file vpMeTracker.h.
Referenced by vpMeTracker::initTracking(), vpMeTracker::operator=(), vpMeTracker::reset(), vpMeTracker::track(), and vpMeTracker::vpMeTracker().
|
protectedinherited |
Moving-edges display type.
Definition at line 323 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().
|
inherited |
Feature coordinates expressed in the image plane p. They correspond to 2D normalized coordinates expressed in meters.
Definition at line 69 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(), vpMeTracker::init(), vpCircle::init(), vpCylinder::init(), vpLine::init(), vpPoint::init(), vpSphere::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().