39#include <visp3/core/vpColor.h>
40#include <visp3/core/vpDisplay.h>
41#include <visp3/me/vpMeTracker.h>
44#include <visp3/core/vpTrackingException.h>
51 const unsigned int val_2 = 2;
94 unsigned int number_signal = 0;
97 number_signal =
static_cast<unsigned int>(std::count_if(
m_meList.begin(),
m_meList.end(), isSuppressZero));
106 return ((mask ==
nullptr) || (mask->
getValue(i, j)));
115 if (meMaskCandidates ==
nullptr) {
119 const unsigned int kernelSize = 3;
120 const unsigned int halfKernelSize = (kernelSize - 1) / 2;
121 const unsigned int nbRows = meMaskCandidates->
getRows();
122 const unsigned int nbCols = meMaskCandidates->
getCols();
124 if ((i >= nbRows) || (j >= nbCols)) {
128 if ((*meMaskCandidates)[i][j]) {
132 unsigned int iStart = 0, jStart = 0;
133 unsigned int iStop = nbRows - 1, jStop = nbCols - 1;
135 if (i >= halfKernelSize) {
136 iStart = i - halfKernelSize;
138 if (j >= halfKernelSize) {
139 jStart = j - halfKernelSize;
141 if ((i + halfKernelSize) < nbRows) {
142 iStop = i + halfKernelSize;
144 if ((j + halfKernelSize) < nbCols) {
145 jStop = j + halfKernelSize;
148 bool isACandidate =
false;
149 unsigned int iter_i = iStart, iter_j = jStart;
151 while ((!isACandidate) && (iter_i <= iStop)) {
153 while ((!isACandidate) && (iter_j <= jStop)) {
154 isACandidate = (*meMaskCandidates)[iter_i][iter_j];
166 int borderWith2SparedPixels = border + 2;
167 return (!((i > borderWith2SparedPixels) && (i < (nrows - borderWith2SparedPixels))
168 && (j > borderWith2SparedPixels) && (j < (ncols - borderWith2SparedPixels))
174 const int borderPlus2 = border + 2;
177 return (!((i > borderPlus2) && (i < (nrows - borderPlus2)) && (j > borderPlus2) && (j < (ncols - borderPlus2))));
187 unsigned int range_tmp =
m_me->getRange();
188 m_me->setRange(
m_me->getInitRange());
193 std::list<vpMeSite>::iterator end =
m_meList.end();
194 for (std::list<vpMeSite>::iterator it =
m_meList.begin(); it != end; ++it) {
210 m_me->setRange(range_tmp);
226 std::list<vpMeSite>::iterator it =
m_meList.begin();
227 std::list<vpMeSite>::iterator end =
m_meList.end();
233 s.track(I,
m_me,
true);
254 std::list<vpMeSite>::const_iterator end =
m_meList.end();
255 for (std::list<vpMeSite>::const_iterator it =
m_meList.begin(); it != end; ++it) {
263 std::list<vpMeSite>::const_iterator end =
m_meList.end();
264 for (std::list<vpMeSite>::const_iterator it =
m_meList.begin(); it != end; ++it) {
272 std::list<vpMeSite>::iterator end =
m_meList.end();
273 for (std::list<vpMeSite>::iterator it =
m_meList.begin(); it != end; ++it) {
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition of the vpImage class member functions.
Type getValue(unsigned int i, unsigned int j) const
unsigned int getCols() const
unsigned int getRows() const
static int round(double x)
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'....
@ OUTSIDE_ROI_MASK
Point is outside the region of interest mask, but retained in the ME list.
@ NO_SUPPRESSION
Point successfully tracked.
void display(const vpImage< unsigned char > &I) const
void setWeight(const double &weight)
vpMeSiteState getState() const
void track(const vpImage< unsigned char > &I, const vpMe *me, const bool &test_contrast=true)
void initTracking(const vpImage< unsigned char > &I)
const vpImage< bool > * m_mask
Mask used to disable tracking on a part of image.
unsigned int numberOfSignal()
vpMeSite::vpMeSiteDisplayType m_selectDisplay
Moving-edges display type.
void track(const vpImage< unsigned char > &I)
unsigned int totalNumberOfSignal()
vpMe * m_me
Moving edges initialisation parameters.
vpMeTracker & operator=(vpMeTracker &meTracker)
static bool inRoiMask(const vpImage< bool > *mask, unsigned int i, unsigned int j)
void display(const vpImage< unsigned char > &I)
int m_nGoodElement
Number of good moving-edges that are tracked.
bool outOfImage(int i, int j, int border, int nrows, int ncols)
const vpImage< bool > * m_maskCandidates
Mask used to determine candidate points for initialization in an image.
virtual ~vpMeTracker() VP_OVERRIDE
std::list< vpMeSite > m_meList
static bool inMeMaskCandidates(const vpImage< bool > *meMaskCandidates, unsigned int i, unsigned int j)
void init()
Default initialization.
vpTracker()
Default constructor.
Error that can be emitted by the vpTracker class and its derivatives.
@ notEnoughPointError
Not enough point to track.
@ initializationError
Tracker initialization error.