Visual Servoing Platform  version 3.6.1 under development (2024-03-18)

#include <visp3/me/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)
 
void display (const vpImage< unsigned char > &I)
 
void display (const vpImage< vpRGBa > &I)
 
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
 
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 > &im, const vpMe *me, const bool &test_likelihood=true)
 
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
 
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.

Definition at line 64 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 70 of file vpMeSite.h.

◆ vpMeSiteState

Moving-edge site state

Enumerator
NO_SUPPRESSION 

Point successfully tracked.

CONTRAST 

Point not tracked due to a likelihood 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 a lack of contrast problem, 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 81 of file vpMeSite.h.

Constructor & Destructor Documentation

◆ vpMeSite() [1/3]

vpMeSite::vpMeSite ( )

Default constructor.

Definition at line 78 of file vpMeSite.cpp.

◆ vpMeSite() [2/3]

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

Constructor from pixel coordinates.

Definition at line 83 of file vpMeSite.cpp.

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

◆ vpMeSite() [3/3]

vpMeSite::vpMeSite ( const vpMeSite mesite)

Copy constructor.

Definition at line 93 of file vpMeSite.cpp.

◆ ~vpMeSite()

virtual vpMeSite::~vpMeSite ( )
inlinevirtual

Destructor.

Definition at line 135 of file vpMeSite.h.

Member Function Documentation

◆ convolution()

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

◆ display() [1/4]

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

Display moving edges in image I.

Parameters
I: Input image.

Definition at line 385 of file vpMeSite.cpp.

References m_ifloat, and m_jfloat.

Referenced by vpMeTracker::display(), and 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 391 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)

Display moving edges in image I.

Parameters
I: Input image.

Definition at line 387 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 420 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()

static 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 328 of file vpMeSite.h.

◆ get_i()

int vpMeSite::get_i ( ) const
inline

Return integer coordinate along i (rows).

See also
get_ifloat()

Definition at line 180 of file vpMeSite.h.

Referenced by vpMeNurbs::seekExtremities(), vpMeTracker::track(), and vpMeNurbs::updateDelta().

◆ get_ifloat()

◆ get_j()

int vpMeSite::get_j ( ) const
inline

Return integer coordinate along j (columns).

See also
get_jfloat()

Definition at line 186 of file vpMeSite.h.

Referenced by vpMeNurbs::seekExtremities(), vpMeTracker::track(), and vpMeNurbs::updateDelta().

◆ get_jfloat()

◆ getAlpha()

double vpMeSite::getAlpha ( ) const
inline

Get the angle of tangent at site.

Returns
value of alpha

Definition at line 159 of file vpMeSite.h.

◆ 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 299 of file vpMeSite.h.

Referenced by track().

◆ 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 173 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().

◆ getState()

◆ getWeight()

double vpMeSite::getWeight ( ) const
inline

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

Definition at line 164 of file vpMeSite.h.

◆ 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 102 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 116 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 129 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 142 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 378 of file vpMeSite.cpp.

References m_i, and m_j.

◆ operator=()

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

Copy operator.

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

◆ setAlpha()

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

Set the angle of tangent at site.

Parameters
a: new value of alpha

Definition at line 237 of file vpMeSite.h.

Referenced by vpMeLine::updateDelta(), and vpMeNurbs::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
thresh: new value of contrast threshold
memoving-edge parameters

Definition at line 281 of file vpMeSite.h.

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

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

◆ setDisplay()

◆ setState()

void vpMeSite::setState ( const vpMeSiteState flag)
inline

◆ 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 268 of file vpMeSite.h.

Referenced by vpMeTracker::display().

◆ sqrDistance()

static 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 344 of file vpMeSite.h.

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

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

◆ track()

Friends And Related Function Documentation

◆ operator<<

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

ostream operator.

Definition at line 380 of file vpMeSite.cpp.

Member Data Documentation

◆ m_alpha

double vpMeSite::m_alpha

Angle of tangent at site.

Definition at line 106 of file vpMeSite.h.

Referenced by convolution(), getQueryList(), init(), operator=(), and vpMeEllipse::updateTheta().

◆ m_contrastThreshold

double vpMeSite::m_contrastThreshold

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

Definition at line 114 of file vpMeSite.h.

Referenced by getQueryList(), init(), and operator=().

◆ m_convlt

double vpMeSite::m_convlt

Convolution of Site in previous image.

Definition at line 108 of file vpMeSite.h.

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

◆ m_i

int vpMeSite::m_i

Integer coordinate along i of a site.

Definition at line 96 of file vpMeSite.h.

Referenced by convolution(), init(), operator!=(), operator=(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremities(), track(), and vpMeSite().

◆ m_ifloat

◆ m_j

int vpMeSite::m_j

◆ m_jfloat

◆ m_mask_sign

int vpMeSite::m_mask_sign

Mask sign.

Definition at line 104 of file vpMeSite.h.

Referenced by convolution(), getQueryList(), init(), operator=(), and vpMeLine::updateDelta().

◆ m_normGradient

double vpMeSite::m_normGradient

Convolution of Site in previous image.

Definition at line 110 of file vpMeSite.h.

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

◆ m_weight

double vpMeSite::m_weight

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

Definition at line 112 of file vpMeSite.h.

Referenced by init(), and operator=().