Visual Servoing Platform
version 3.6.1 under development (2024-11-21)
|
#include <visp3/me/vpMeSite.h>
Public Types | |
enum | vpMeSiteDisplayType { NONE , RANGE , RESULT , RANGE_RESULT } |
enum | vpMeSiteState { NO_SUPPRESSION = 0 , CONTRAST = 1 , THRESHOLD = 2 , M_ESTIMATOR = 3 , TOO_NEAR = 4 , UNKNOW = 5 , OUTSIDE_ROI_MASK = 6 } |
Public Member Functions | |
vpMeSite () | |
vpMeSite (const double &ip, const double &jp) | |
vpMeSite (const vpMeSite &mesite) | |
virtual | ~vpMeSite () |
double | convolution (const vpImage< unsigned char > &ima, const vpMe *me) |
void | display (const vpImage< unsigned char > &I) const |
void | display (const vpImage< vpRGBa > &I) const |
double | getAlpha () const |
double | getWeight () const |
vpMeSite * | getQueryList (const vpImage< unsigned char > &I, const int &range) const |
int | get_i () const |
int | get_j () const |
double | get_ifloat () const |
double | get_jfloat () const |
void | init () |
void | init (const double &ip, const double &jp, const double &alphap) |
void | init (const double &ip, const double &jp, const double &alphap, const double &convltp) |
void | init (const double &ip, const double &jp, const double &alphap, const double &convltp, const int &sign) |
void | init (const double &ip, const double &jp, const double &alphap, const double &convltp, const int &sign, const double &contrastThreshold) |
void | track (const vpImage< unsigned char > &I, const vpMe *me, const bool &test_contrast=true) |
void | trackMultipleHypotheses (const vpImage< unsigned char > &I, const vpMe &me, const bool &test_contrast, std::vector< vpMeSite > &outputHypotheses, const unsigned numCandidates) |
void | setAlpha (const double &a) |
void | setDisplay (vpMeSiteDisplayType select) |
void | setState (const vpMeSiteState &flag) |
vpMeSiteState | getState () const |
void | setWeight (const double &weight) |
void | setContrastThreshold (const double &thresh, const vpMe &me) |
double | getContrastThreshold () const |
double | computeFinalThreshold (const vpMe &me) const |
vpMeSite & | operator= (const vpMeSite &m) |
int | operator!= (const vpMeSite &m) |
Static Public Member Functions | |
static double | distance (const vpMeSite &S1, const vpMeSite &S2) |
static double | sqrDistance (const vpMeSite &S1, const vpMeSite &S2) |
static void | display (const vpImage< unsigned char > &I, const double &i, const double &j, const vpMeSiteState &state=NO_SUPPRESSION) |
static void | display (const vpImage< vpRGBa > &I, const double &i, const double &j, const vpMeSiteState &state=NO_SUPPRESSION) |
Public Attributes | |
int | m_i |
int | m_j |
double | m_ifloat |
double | m_jfloat |
int | m_mask_sign |
double | m_alpha |
double | m_convlt |
double | m_normGradient |
double | m_weight |
double | m_contrastThreshold |
Friends | |
VISP_EXPORT std::ostream & | operator<< (std::ostream &os, vpMeSite &vpMeS) |
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'. Gives the most likely site given the probability from an ME mask.
Definition at line 67 of file vpMeSite.h.
Type moving-edges site of display.
Enumerator | |
---|---|
NONE | Not displayed. |
RANGE | |
RESULT | |
RANGE_RESULT |
Definition at line 73 of file vpMeSite.h.
Moving-edge site state
Definition at line 84 of file vpMeSite.h.
vpMeSite::vpMeSite | ( | ) |
Default constructor.
Definition at line 93 of file vpMeSite.cpp.
vpMeSite::vpMeSite | ( | const double & | ip, |
const double & | jp | ||
) |
Constructor from pixel coordinates.
Definition at line 98 of file vpMeSite.cpp.
References m_i, m_ifloat, m_j, m_jfloat, and vpMath::round().
vpMeSite::vpMeSite | ( | const vpMeSite & | mesite | ) |
Copy constructor.
Definition at line 108 of file vpMeSite.cpp.
|
inlinevirtual |
Destructor.
Definition at line 138 of file vpMeSite.h.
|
inline |
Get the final computed likelihood threshold value, depending on the likelihood threshold type and ME settings.
Definition at line 329 of file vpMeSite.h.
References vpMe::getLikelihoodThresholdType(), vpMe::getMaskSize(), and vpMe::NORMALIZED_THRESHOLD.
Referenced by track(), and trackMultipleHypotheses().
Compute convolution.
Definition at line 227 of file vpMeSite.cpp.
References vpMe::getAngleStep(), vpImage< Type >::getHeight(), vpMe::getMask(), vpMe::getMaskSize(), vpMe::getStrip(), vpImage< Type >::getWidth(), m_alpha, m_i, m_j, m_mask_sign, and vpMath::round().
Referenced by vpMeEllipse::plugHoles(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeLine::seekExtremities(), track(), and trackMultipleHypotheses().
void vpMeSite::display | ( | const vpImage< unsigned char > & | I | ) | const |
Display moving edges in image I.
I | : Input image. |
Definition at line 486 of file vpMeSite.cpp.
References m_ifloat, and m_jfloat.
Referenced by vpMeTracker::display(), and display().
|
static |
Display the moving edge site with a color corresponding to their state.
I | : The image. |
i | : Pixel i of the site. |
j | : Pixel j of the site. |
state | : State of the site. |
Definition at line 492 of file vpMeSite.cpp.
References vpColor::blue, CONTRAST, vpColor::cyan, vpDisplay::displayCross(), vpColor::green, M_ESTIMATOR, NO_SUPPRESSION, OUTSIDE_ROI_MASK, vpColor::purple, vpColor::red, THRESHOLD, and vpColor::yellow.
Display moving edges in image I.
I | : Input image. |
Definition at line 488 of file vpMeSite.cpp.
|
static |
Display the moving edge site with a color corresponding to their state.
I | : The image. |
i | : Pixel i of the site. |
j | : Pixel j of the site. |
state | : State of the site. |
Definition at line 521 of file vpMeSite.cpp.
References vpColor::blue, CONTRAST, vpColor::cyan, vpDisplay::displayCross(), vpColor::green, M_ESTIMATOR, NO_SUPPRESSION, OUTSIDE_ROI_MASK, vpColor::purple, vpColor::red, THRESHOLD, and vpColor::yellow.
Compute the square root distance between two moving-edges sites
S1 | : First site |
S2 | : Second site |
Definition at line 368 of file vpMeSite.h.
|
inline |
Return integer coordinate along i (rows).
Definition at line 183 of file vpMeSite.h.
Referenced by vpMeNurbs::seekExtremities(), vpMeTracker::track(), and vpMeNurbs::updateDelta().
|
inline |
Return subpixel coordinate along i (rows).
Definition at line 195 of file vpMeSite.h.
Referenced by vpMbtDistanceCircle::getFeaturesForDisplay(), vpMbtDistanceCylinder::getFeaturesForDisplay(), vpMbtDistanceLine::getFeaturesForDisplay(), vpNurbs::globalCurveApprox(), vpNurbs::globalCurveInterp(), vpMeEllipse::leastSquareRobustCircle(), vpMeEllipse::leastSquareRobustEllipse(), and vpMeEllipse::plugHoles().
|
inline |
Return integer coordinate along j (columns).
Definition at line 189 of file vpMeSite.h.
Referenced by vpMeNurbs::seekExtremities(), vpMeTracker::track(), and vpMeNurbs::updateDelta().
|
inline |
Return subpixel coordinate along j (columns).
Definition at line 201 of file vpMeSite.h.
Referenced by vpMbtDistanceCircle::getFeaturesForDisplay(), vpMbtDistanceCylinder::getFeaturesForDisplay(), vpMbtDistanceLine::getFeaturesForDisplay(), vpNurbs::globalCurveApprox(), vpNurbs::globalCurveInterp(), vpMeEllipse::leastSquareRobustCircle(), vpMeEllipse::leastSquareRobustEllipse(), and vpMeEllipse::plugHoles().
|
inline |
|
inline |
Get the contrast threshold of the site.
Definition at line 321 of file vpMeSite.h.
Construct and return the list of vpMeSite along the normal to the contour, in the given range.
I | : Image in which the display is performed. |
range | : +/- the range within which the pixel's correspondent will be sought. |
Definition at line 188 of file vpMeSite.cpp.
References vpDisplay::displayCross(), init(), m_alpha, m_contrastThreshold, m_convlt, m_ifloat, m_jfloat, m_mask_sign, RANGE, RANGE_RESULT, vpImagePoint::set_i(), vpImagePoint::set_j(), setDisplay(), and vpColor::yellow.
Referenced by track(), and trackMultipleHypotheses().
|
inline |
Get the state of the site.
Definition at line 283 of file vpMeSite.h.
Referenced by vpMbEdgeTracker::computeVVSFirstPhase(), vpMbEdgeTracker::computeVVSFirstPhaseFactor(), vpMeTracker::display(), vpMeLine::displayLine(), vpMbtDistanceCircle::getFeaturesForDisplay(), vpMbtDistanceCylinder::getFeaturesForDisplay(), vpMbtDistanceLine::getFeaturesForDisplay(), vpMeTracker::initTracking(), vpMeLine::leastSquare(), vpMeEllipse::leastSquareRobust(), vpMeEllipse::leastSquareRobustCircle(), vpMeEllipse::leastSquareRobustEllipse(), vpMeNurbs::localReSample(), vpMeEllipse::plugHoles(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremities(), vpMeLine::suppressPoints(), vpMeNurbs::suppressPoints(), vpMbEdgeTracker::testTracking(), and vpMeTracker::track().
|
inline |
Return site weight or uncertainty as a probability between 0 and 1.
Definition at line 167 of file vpMeSite.h.
BEGIN_VISP_NAMESPACE void vpMeSite::init | ( | void | ) |
Initialize moving-edge site with default parameters.
Definition at line 70 of file vpMeSite.cpp.
References m_alpha, m_contrastThreshold, m_convlt, m_i, m_ifloat, m_j, m_jfloat, m_mask_sign, m_normGradient, m_weight, NO_SUPPRESSION, and NONE.
Referenced by getQueryList(), vpMeNurbs::localReSample(), vpMeEllipse::plugHoles(), vpMeNurbs::sample(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremities(), and vpMeNurbs::seekExtremitiesCanny().
void vpMeSite::init | ( | const double & | ip, |
const double & | jp, | ||
const double & | alphap | ||
) |
Initialize moving-edge site parameters.
Definition at line 117 of file vpMeSite.cpp.
References m_alpha, m_i, m_ifloat, m_j, m_jfloat, m_mask_sign, NONE, and vpMath::round().
void vpMeSite::init | ( | const double & | ip, |
const double & | jp, | ||
const double & | alphap, | ||
const double & | convltp | ||
) |
Initialize moving-edge site parameters.
Definition at line 131 of file vpMeSite.cpp.
References m_alpha, m_convlt, m_i, m_ifloat, m_j, m_jfloat, m_mask_sign, and NONE.
void vpMeSite::init | ( | const double & | ip, |
const double & | jp, | ||
const double & | alphap, | ||
const double & | convltp, | ||
const int & | sign | ||
) |
Initialize moving-edge site parameters.
Definition at line 144 of file vpMeSite.cpp.
References m_alpha, m_convlt, m_i, m_ifloat, m_j, m_jfloat, m_mask_sign, and NONE.
void vpMeSite::init | ( | const double & | ip, |
const double & | jp, | ||
const double & | alphap, | ||
const double & | convltp, | ||
const int & | sign, | ||
const double & | contrastThreshold | ||
) |
Initialize moving-edge site parameters.
Definition at line 157 of file vpMeSite.cpp.
References m_alpha, m_contrastThreshold, m_convlt, m_i, m_ifloat, m_j, m_jfloat, m_mask_sign, and NONE.
int vpMeSite::operator!= | ( | const vpMeSite & | m | ) |
Copy operator.
Definition at line 170 of file vpMeSite.cpp.
References m_alpha, m_contrastThreshold, m_convlt, m_i, m_ifloat, m_j, m_jfloat, m_mask_sign, m_normGradient, and m_weight.
|
inline |
Set the angle of tangent at site.
a | : new value of alpha |
Definition at line 259 of file vpMeSite.h.
Referenced by vpMeLine::updateDelta(), and vpMeNurbs::updateDelta().
|
inline |
Set the contrast threshold of the site. If the vpMe::m_useAutomaticThreshold is set to false, the contrast threshold is set to the global value retrieved using vpMe::getThreshold(). This value can be set using vpMe::setThreshold(). Otherwise, the contrast threshold will be set to the highest value between thresh and the minimum value set by vpMe::setMinThreshold() that could be retrieved using vpMe::getMinThreshold().
thresh | : new value of contrast threshold |
me | moving-edge parameters |
Definition at line 303 of file vpMeSite.h.
References vpMe::getMinThreshold(), vpMe::getThreshold(), and vpMe::getUseAutomaticThreshold().
Referenced by vpMeEllipse::plugHoles(), vpMeEllipse::sample(), vpMeLine::sample(), and vpMeLine::seekExtremities().
|
inline |
Display selector.
Definition at line 264 of file vpMeSite.h.
Referenced by getQueryList(), vpMeNurbs::localReSample(), vpMeEllipse::plugHoles(), vpMeNurbs::sample(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremities(), and vpMeNurbs::seekExtremitiesCanny().
|
inline |
Set the state of the site.
flag | : flag corresponding to vpMeSiteState |
Definition at line 273 of file vpMeSite.h.
Referenced by vpMeLine::leastSquare(), vpMeEllipse::plugHoles(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeNurbs::supressNearPoints(), vpMeTracker::track(), and vpMbEdgeTracker::updateMovingEdgeWeights().
|
inline |
Set the weight or uncertainty of the site.
weight | : New value of weight as a probability between 0 and 1. |
Definition at line 290 of file vpMeSite.h.
Referenced by vpMeTracker::display().
Compute the square distance between two moving-edges sites
S1 | : First site |
S2 | : Second site |
Definition at line 384 of file vpMeSite.h.
References m_ifloat, m_jfloat, and vpMath::sqr().
Referenced by vpMeNurbs::localReSample(), vpMeNurbs::seekExtremitiesCanny(), and vpMeNurbs::supressNearPoints().
void vpMeSite::track | ( | const vpImage< unsigned char > & | I, |
const vpMe * | me, | ||
const bool & | test_contrast = true |
||
) |
Specific function for moving-edges.
[in] | I | : Input image. |
[in] | me | : Pointer to the moving-edges settings. |
[in] | test_contrast | : When true tracking is based on contrast. The retained moving-edge is the one with similar contrast. When false, the tracking is based on the likelihood. The retained moving-edge is the one with the maximum likelihood. |
Definition at line 282 of file vpMeSite.cpp.
References computeFinalThreshold(), CONTRAST, convolution(), vpDisplay::displayPoint(), vpMe::getMu1(), vpMe::getMu2(), getQueryList(), vpMe::getRange(), vpColor::green, m_convlt, m_i, m_j, m_normGradient, RANGE_RESULT, vpColor::red, RESULT, vpImagePoint::set_i(), vpImagePoint::set_j(), vpMath::sqr(), and THRESHOLD.
Referenced by vpMeTracker::initTracking(), vpMeNurbs::localReSample(), vpMeEllipse::plugHoles(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremities(), vpMeNurbs::seekExtremitiesCanny(), and vpMeTracker::track().
void vpMeSite::trackMultipleHypotheses | ( | const vpImage< unsigned char > & | I, |
const vpMe & | me, | ||
const bool & | test_contrast, | ||
std::vector< vpMeSite > & | outputHypotheses, | ||
const unsigned | numCandidates | ||
) |
Similar to the track() function, but stores the best numCandidates hypotheses in outputHypotheses
. The best matching hypotheses (if it is not suppressed) is assigned to this and is stored as the first element of outputHypotheses
. The hypotheses are sorted from best to worst match in the vector. A match may be in the vector but mark as suppressed. If this is undesired, you should filter them afterwards.
If | numCandidates is superior to me.getRange() * 2 + 1. |
Definition at line 372 of file vpMeSite.cpp.
References vpException::badValue, computeFinalThreshold(), CONTRAST, convolution(), vpDisplay::displayPoint(), vpMe::getMu1(), vpMe::getMu2(), getQueryList(), vpMe::getRange(), vpColor::green, m_convlt, m_i, m_j, m_normGradient, NO_SUPPRESSION, RANGE_RESULT, vpColor::red, RESULT, vpMath::sqr(), and THRESHOLD.
|
friend |
ostream operator.
Definition at line 550 of file vpMeSite.cpp.
double vpMeSite::m_alpha |
Angle of tangent at site.
Definition at line 109 of file vpMeSite.h.
Referenced by convolution(), getQueryList(), init(), operator=(), and vpMeEllipse::updateTheta().
double vpMeSite::m_contrastThreshold |
Old likelihood ratio threshold (to be avoided) or easy-to-use normalized threshold: minimal contrast.
Definition at line 117 of file vpMeSite.h.
Referenced by getQueryList(), init(), and operator=().
double vpMeSite::m_convlt |
Convolution of Site in previous image.
Definition at line 111 of file vpMeSite.h.
Referenced by getQueryList(), init(), operator=(), track(), and trackMultipleHypotheses().
int vpMeSite::m_i |
Integer coordinate along i of a site.
Definition at line 99 of file vpMeSite.h.
Referenced by convolution(), init(), operator!=(), operator=(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremities(), track(), trackMultipleHypotheses(), and vpMeSite().
double vpMeSite::m_ifloat |
Subpixel coordinates along i of a site.
Definition at line 103 of file vpMeSite.h.
Referenced by display(), vpMeLine::displayLine(), getQueryList(), init(), vpMeLine::initTracking(), vpMeLine::leastSquare(), vpMeEllipse::leastSquareRobust(), vpMeNurbs::localReSample(), operator=(), vpMeLine::reSample(), vpMeLine::sample(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremities(), vpMeNurbs::seekExtremitiesCanny(), vpMeLine::setExtremities(), sqrDistance(), vpMeEllipse::updateTheta(), and vpMeSite().
int vpMeSite::m_j |
Integer coordinates along j of a site.
Definition at line 101 of file vpMeSite.h.
Referenced by vpMbtDistanceCylinder::computeInteractionMatrixError(), convolution(), init(), operator!=(), operator=(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremities(), track(), trackMultipleHypotheses(), and vpMeSite().
double vpMeSite::m_jfloat |
Subpixel coordinates along j of a site.
Definition at line 105 of file vpMeSite.h.
Referenced by display(), vpMeLine::displayLine(), getQueryList(), init(), vpMeLine::initTracking(), vpMeLine::leastSquare(), vpMeEllipse::leastSquareRobust(), vpMeNurbs::localReSample(), operator=(), vpMeLine::reSample(), vpMeLine::sample(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremities(), vpMeNurbs::seekExtremitiesCanny(), vpMeLine::setExtremities(), sqrDistance(), vpMeEllipse::updateTheta(), and vpMeSite().
int vpMeSite::m_mask_sign |
Mask sign.
Definition at line 107 of file vpMeSite.h.
Referenced by convolution(), getQueryList(), init(), operator=(), and vpMeLine::updateDelta().
double vpMeSite::m_normGradient |
Convolution of Site in previous image.
Definition at line 113 of file vpMeSite.h.
Referenced by init(), operator=(), track(), and trackMultipleHypotheses().
double vpMeSite::m_weight |
Uncertainty of point given as a probability between 0 and 1.
Definition at line 115 of file vpMeSite.h.
Referenced by init(), and operator=().