Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches

#include <vpMeSite.h>

Public Types

enum  vpMeSiteDisplayType { NONE , RANGE , RESULT , RANGE_RESULT }
enum  vpMeSiteState {
  NO_SUPPRESSION = 0 , CONTRAST = 1 , CONSTRAST = CONTRAST , 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)
double convolution (const vpImage< unsigned char > &ima, const vpMe &me, const unsigned int mask_index)
unsigned int computeMaskIndex (const double alpha, const vpMe &me)
void display (const vpImage< unsigned char > &I) const
void display (const vpImage< vpRGBa > &I) const
double getAlpha () const
double getWeight () const
vpMeSitegetQueryList (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
unsigned int getIndex () 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
vpMeSiteoperator= (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)

Detailed Description

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.

  • Bug fix: rewrote application of masks to use the temporal information instead of applying both temporal masks to the same image. ie: spatial -> spatio/temporal
  • Added new tracking function to choose the most similar edge amongst all edges found.
  • sample step.

Tutorials & Examples

Tutorials
If you are interested in using a ME tracker in your application, you may have a look at:

Definition at line 74 of file vpMeSite.h.

Member Enumeration Documentation

◆ vpMeSiteDisplayType

Type moving-edges site of display.

Enumerator
NONE 

Not displayed.

RANGE 
RESULT 
RANGE_RESULT 

Definition at line 80 of file vpMeSite.h.

◆ vpMeSiteState

Moving-edge site state

Enumerator
NO_SUPPRESSION 

Point successfully tracked.

CONTRAST 

Point not tracked due to a contrast problem, but retained in the ME list.

CONSTRAST 

Deprecated. Point not tracked due to a likelihood problem, but retained in the ME list. Use instead CONTRAST.

THRESHOLD 

Point not tracked due to the likelihood that is below the threshold, but retained in the ME list.

M_ESTIMATOR 

Point detected as an outlier during virtual visual-servoing.

TOO_NEAR 

Point not tracked anymore, since too near from its neighbor.

UNKNOW 

Reserved.

OUTSIDE_ROI_MASK 

Point is outside the region of interest mask, but retained in the ME list.

Definition at line 91 of file vpMeSite.h.

Constructor & Destructor Documentation

◆ vpMeSite() [1/3]

◆ vpMeSite() [2/3]

vpMeSite::vpMeSite ( const double & ip,
const double & jp )

Constructor from pixel coordinates.

Definition at line 100 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, NONE, and vpMath::round().

◆ vpMeSite() [3/3]

vpMeSite::vpMeSite ( const vpMeSite & mesite)

Copy constructor.

Definition at line 110 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, NONE, and vpMeSite().

◆ ~vpMeSite()

virtual vpMeSite::~vpMeSite ( )
inlinevirtual

Destructor.

Definition at line 145 of file vpMeSite.h.

Member Function Documentation

◆ computeFinalThreshold()

double vpMeSite::computeFinalThreshold ( const vpMe & me) const
inline

Get the final computed likelihood threshold value, depending on the likelihood threshold type and ME settings.

Returns
value of the contrast threshold of the site.

Definition at line 352 of file vpMeSite.h.

References getContrastThreshold(), vpMe::getLikelihoodThresholdType(), vpMe::getMaskSize(), and vpMe::NORMALIZED_THRESHOLD.

Referenced by track(), and trackMultipleHypotheses().

◆ computeMaskIndex()

unsigned int vpMeSite::computeMaskIndex ( const double alpha,
const vpMe & me )

Compute the index mask in [0:179] for convolution.

Specific function for ME. Compute the mask index in [0:179] for convolution

Definition at line 236 of file vpMeSite.cpp.

References vpMath::deg(), vpMe::getAngleStep(), and vpMath::round().

Referenced by convolution(), track(), and trackMultipleHypotheses().

◆ convolution() [1/2]

double vpMeSite::convolution ( const vpImage< unsigned char > & I,
const vpMe & me,
const unsigned int mask_index )

Compute convolution for a given mask_index.

Specific function for ME.

Definition at line 297 of file vpMeSite.cpp.

References vpMe::getMask(), vpMe::getMaskSize(), vpMe::getStrip(), m_i, m_j, and m_mask_sign.

◆ convolution() [2/2]

double vpMeSite::convolution ( const vpImage< unsigned char > & ima,
const vpMe * me )

◆ display() [1/4]

void vpMeSite::display ( const vpImage< unsigned char > & I) const

Display moving edges in image I.

Parameters
I: Input image.

Definition at line 547 of file vpMeSite.cpp.

References display(), m_ifloat, and m_jfloat.

Referenced by display(), display(), vpMeTracker::display(), and vpMeTracker::display().

◆ display() [2/4]

void vpMeSite::display ( const vpImage< unsigned char > & I,
const double & i,
const double & j,
const vpMeSiteState & state = NO_SUPPRESSION )
static

Display the moving edge site with a color corresponding to their state.

  • If green : The vpMeSite is a good point.
  • If blue : The point is removed because of the vpMeSite tracking phase (contrast problem).
  • If purple : The point is removed because of the vpMeSite tracking phase (threshold problem).
  • If red : The point is removed because of the robust method in the virtual visual servoing (M-Estimator problem).
  • If cyan : The point is outside the mask, see vpMeTracker::setMask().
  • Yellow otherwise.
Parameters
I: The image.
i: Pixel i of the site.
j: Pixel j of the site.
state: State of the site.

Definition at line 553 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() [3/4]

void vpMeSite::display ( const vpImage< vpRGBa > & I) const

Display moving edges in image I.

Parameters
I: Input image.

Definition at line 549 of file vpMeSite.cpp.

References display(), m_ifloat, and m_jfloat.

◆ display() [4/4]

void vpMeSite::display ( const vpImage< vpRGBa > & I,
const double & i,
const double & j,
const vpMeSiteState & state = NO_SUPPRESSION )
static

Display the moving edge site with a color corresponding to their state.

  • If green : The vpMeSite is a good point.
  • If blue : The point is removed because of the vpMeSite tracking phase (contrast problem).
  • If purple : The point is removed because of the vpMeSite tracking phase (threshold problem).
  • If red : The point is removed because of the robust method in the virtual visual servoing (M-Estimator problem).
  • If cyan : The point is outside the mask, see vpMeTracker::setMask().
  • Yellow otherwise
Parameters
I: The image.
i: Pixel i of the site.
j: Pixel j of the site.
state: State of the site.

Definition at line 582 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.

◆ distance()

double vpMeSite::distance ( const vpMeSite & S1,
const vpMeSite & S2 )
inlinestatic

Compute the square root distance between two moving-edges sites $ |S1 - S2| = \sqrt{(i_1-i_2)^2+(j_1-j_2)^2} $

Parameters
S1: First site
S2: Second site
Returns
the distance between the two sites.
See also
sqrDistance()

Definition at line 391 of file vpMeSite.h.

References sqrDistance(), and vpMeSite().

◆ get_i()

int vpMeSite::get_i ( ) const
inline

Return integer coordinate along i (rows).

See also
get_ifloat()

Definition at line 200 of file vpMeSite.h.

References m_i.

Referenced by vpMeNurbs::seekExtremities().

◆ get_ifloat()

◆ get_j()

int vpMeSite::get_j ( ) const
inline

Return integer coordinate along j (columns).

See also
get_jfloat()

Definition at line 206 of file vpMeSite.h.

References m_j.

Referenced by vpMeNurbs::seekExtremities().

◆ get_jfloat()

double vpMeSite::get_jfloat ( ) const
inline

◆ getAlpha()

double vpMeSite::getAlpha ( ) const
inline

Get the angle of tangent at site.

Returns
value of alpha

Definition at line 179 of file vpMeSite.h.

References m_alpha.

◆ getContrastThreshold()

double vpMeSite::getContrastThreshold ( ) const
inline

Get the contrast threshold of the site.

Returns
value of the contrast threshold of the site.

Definition at line 344 of file vpMeSite.h.

References m_contrastThreshold.

Referenced by computeFinalThreshold().

◆ getIndex()

unsigned int vpMeSite::getIndex ( ) const
inline

Return the convolution index in [0:179].

See also
computeMaskIndex()

Definition at line 224 of file vpMeSite.h.

Referenced by vpMeLine::computeRhoTheta().

◆ getQueryList()

vpMeSite * vpMeSite::getQueryList ( const vpImage< unsigned char > & I,
const int & range ) const

Construct and return the list of vpMeSite along the normal to the contour, in the given range.

Precondition
: Subpixel coordinates (ifloat, jfloat) and the direction of the normal (alpha) have to be set.
Parameters
I: Image in which the display is performed.
range: +/- the range within which the pixel's correspondent will be sought.
Returns
Pointer to the list of query sites

Definition at line 194 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(), vpMeSite(), and vpColor::yellow.

Referenced by track(), and trackMultipleHypotheses().

◆ getState()

◆ getWeight()

double vpMeSite::getWeight ( ) const
inline

Return site weight or uncertainty as a probability between 0 and 1.

Definition at line 184 of file vpMeSite.h.

References m_weight.

◆ init() [1/5]

◆ init() [2/5]

void vpMeSite::init ( const double & ip,
const double & jp,
const double & alphap )

Initialize moving-edge site parameters.

Definition at line 119 of file vpMeSite.cpp.

References m_alpha, m_i, m_ifloat, m_j, m_jfloat, m_mask_sign, NONE, and vpMath::round().

◆ init() [3/5]

void vpMeSite::init ( const double & ip,
const double & jp,
const double & alphap,
const double & convltp )

Initialize moving-edge site parameters.

Definition at line 134 of file vpMeSite.cpp.

References m_alpha, m_convlt, m_i, m_ifloat, m_j, m_jfloat, m_mask_sign, and NONE.

◆ init() [4/5]

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 148 of file vpMeSite.cpp.

References m_alpha, m_convlt, m_i, m_ifloat, m_j, m_jfloat, m_mask_sign, and NONE.

◆ init() [5/5]

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 162 of file vpMeSite.cpp.

References m_alpha, m_contrastThreshold, m_convlt, m_i, m_ifloat, m_j, m_jfloat, m_mask_sign, and NONE.

◆ operator!=()

int vpMeSite::operator!= ( const vpMeSite & m)

Comparison operator.

Definition at line 545 of file vpMeSite.cpp.

References m_i, m_j, and vpMeSite().

◆ operator=()

vpMeSite & vpMeSite::operator= ( const vpMeSite & m)

Copy operator.

Definition at line 176 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, and vpMeSite().

◆ setAlpha()

void vpMeSite::setAlpha ( const double & a)
inline

Set the angle of tangent at site.

Parameters
a: new value of alpha

Definition at line 282 of file vpMeSite.h.

References m_alpha.

Referenced by vpMeLine::updateDelta().

◆ setContrastThreshold()

void vpMeSite::setContrastThreshold ( const double & thresh,
const vpMe & me )
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().

Parameters
[in]thresh: new value of contrast threshold
[in]me: moving-edge parameters

Definition at line 326 of file vpMeSite.h.

References vpMe::getMinThreshold(), vpMe::getThreshold(), vpMe::getUseAutomaticThreshold(), and m_contrastThreshold.

Referenced by vpMeEllipse::plugHoles(), vpMeLine::plugHoles(), vpMeEllipse::sample(), vpMeLine::sample(), and vpMeLine::seekExtremities().

◆ setDisplay()

◆ setState()

void vpMeSite::setState ( const vpMeSiteState & flag)
inline

Set the state of the site.

Parameters
flag: flag corresponding to vpMeSiteState
See also
vpMeSiteState

Definition at line 296 of file vpMeSite.h.

Referenced by vpMeEllipse::plugHoles(), vpMeLine::plugHoles(), vpMeEllipse::sample(), vpMeLine::sample(), and vpMeNurbs::supressNearPoints().

◆ setWeight()

void vpMeSite::setWeight ( const double & weight)
inline

Set the weight or uncertainty of the site.

Parameters
weight: New value of weight as a probability between 0 and 1.

Definition at line 313 of file vpMeSite.h.

References m_weight.

Referenced by vpMeTracker::display().

◆ sqrDistance()

double vpMeSite::sqrDistance ( const vpMeSite & S1,
const vpMeSite & S2 )
inlinestatic

Compute the square distance between two moving-edges sites $ |S1 - S2| = (i_1-i_2)^2+(j_1-j_2)^2 $

Parameters
S1: First site
S2: Second site
Returns
The square distance between the two sites.
See also
distance()

Definition at line 407 of file vpMeSite.h.

References m_ifloat, m_jfloat, vpMath::sqr(), and vpMeSite().

Referenced by distance(), vpMeNurbs::localReSample(), vpMeNurbs::seekExtremitiesCanny(), and vpMeNurbs::supressNearPoints().

◆ track()

void vpMeSite::track ( const vpImage< unsigned char > & I,
const vpMe * me,
const bool & test_contrast = true )

Specific function for moving-edges.

Warning
To display the moving edges graphics a call to vpDisplay::flush() is needed after this function.
Parameters
[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 330 of file vpMeSite.cpp.

References vpMath::abs(), computeFinalThreshold(), computeMaskIndex(), CONTRAST, convolution(), vpDisplay::displayPoint(), vpMe::getMu1(), vpMe::getMu2(), getQueryList(), vpMe::getRange(), vpColor::green, m_alpha, m_convlt, m_i, m_j, m_mask_sign, m_normGradient, RANGE_RESULT, vpColor::red, RESULT, vpImagePoint::set_i(), vpImagePoint::set_j(), vpMath::sqr(), THRESHOLD, and vpMeSite().

Referenced by vpMeTracker::initTracking(), vpMeNurbs::localReSample(), vpMeEllipse::plugHoles(), vpMeLine::plugHoles(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremities(), and vpMeNurbs::seekExtremitiesCanny().

◆ trackMultipleHypotheses()

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.

Exceptions
IfnumCandidates is superior to me.getRange() * 2 + 1.
Warning
To display the moving edges graphics a call to vpDisplay::flush() is needed after this function.

Definition at line 429 of file vpMeSite.cpp.

References vpMath::abs(), vpException::badValue, computeFinalThreshold(), computeMaskIndex(), CONTRAST, convolution(), vpDisplay::displayPoint(), vpMe::getMu1(), vpMe::getMu2(), getQueryList(), vpMe::getRange(), vpColor::green, m_alpha, m_convlt, m_i, m_j, m_mask_sign, m_normGradient, NO_SUPPRESSION, RANGE_RESULT, vpColor::red, RESULT, vpMath::sqr(), THRESHOLD, and vpMeSite().

◆ operator<<

VISP_EXPORT std::ostream & operator<< ( std::ostream & os,
vpMeSite & vpMeS )
friend

ostream operator.

Definition at line 611 of file vpMeSite.cpp.

References m_alpha, m_contrastThreshold, m_convlt, m_weight, operator<<, and vpMeSite().

Referenced by operator<<.

Member Data Documentation

◆ m_alpha

double vpMeSite::m_alpha

◆ m_contrastThreshold

double vpMeSite::m_contrastThreshold

Old likelihood ratio threshold (to be avoided) or easy-to-use normalized threshold: minimal contrast.

Definition at line 124 of file vpMeSite.h.

Referenced by getContrastThreshold(), getQueryList(), init(), init(), operator<<, operator=(), setContrastThreshold(), vpMeSite(), vpMeSite(), and vpMeSite().

◆ m_convlt

double vpMeSite::m_convlt

Convolution of Site in previous image.

Definition at line 118 of file vpMeSite.h.

Referenced by getQueryList(), init(), init(), init(), init(), operator<<, operator=(), track(), trackMultipleHypotheses(), vpMeSite(), vpMeSite(), and vpMeSite().

◆ m_i

◆ m_ifloat

◆ m_j

◆ m_jfloat

◆ m_mask_sign

◆ m_normGradient

double vpMeSite::m_normGradient

Convolution of Site in previous image.

Definition at line 120 of file vpMeSite.h.

Referenced by init(), operator=(), track(), trackMultipleHypotheses(), vpMeSite(), vpMeSite(), and vpMeSite().

◆ m_weight

double vpMeSite::m_weight

Uncertainty of point given as a probability between 0 and 1.

Definition at line 122 of file vpMeSite.h.

Referenced by getWeight(), init(), operator<<, operator=(), setWeight(), vpMeSite(), vpMeSite(), and vpMeSite().