42 #include <visp3/core/vpImage.h>
43 #include <visp3/core/vpMath.h>
44 #include <visp3/core/vpMatrix.h>
135 NORMALIZED_THRESHOLD = 1
136 } vpLikelihoodThresholdType;
139 vpLikelihoodThresholdType m_likelihood_threshold_type;
142 double m_thresholdMarginRatio;
143 double m_minThreshold;
144 bool m_useAutomaticThreshold;
147 double m_min_samplestep;
148 unsigned int m_anglestep;
150 unsigned int m_range;
151 double m_sample_step;
153 int m_points_to_track;
155 unsigned int m_mask_size;
157 unsigned int m_mask_number;
184 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
198 if (sample_step < m_min_samplestep)
199 sample_step = m_min_samplestep;
254 inline double getMu1()
const {
return m_mu1; }
261 inline double getMu2()
const {
return m_mu2; }
282 inline unsigned int getRange()
const {
return m_range; }
359 void setAngleStep(
const unsigned int &anglestep) { m_anglestep = anglestep; }
368 void setMaskNumber(
const unsigned int &mask_number);
375 void setMaskSign(
const int &mask_sign) { m_mask_sign = mask_sign; }
384 void setMaskSize(
const unsigned int &mask_size);
399 void setMu1(
const double &mu_1) { this->m_mu1 = mu_1; }
406 void setMu2(
const double &mu_2) { this->m_mu2 = mu_2; }
429 void setRange(
const unsigned int &range) { m_range = range; }
436 void setSampleStep(
const double &sample_step) { m_sample_step = sample_step; }
443 void setStrip(
const int &strip) { m_strip = strip; }
480 void setThreshold(
const double &threshold) { m_threshold = threshold; }
491 if (thresholdMarginRatio > 1.) {
492 throw(
vpException(
vpException::badValue,
"Threshold margin ratio must be between 0 and 1 if you want to use automatic threshold computation, or negative otherwise"));
494 m_thresholdMarginRatio = thresholdMarginRatio;
495 m_useAutomaticThreshold = (m_thresholdMarginRatio > 0) && (m_minThreshold > 0);
507 m_minThreshold = minThreshold;
508 m_useAutomaticThreshold = (m_thresholdMarginRatio > 0) && (m_minThreshold > 0);
521 #ifdef VISP_HAVE_NLOHMANN_JSON
528 friend void to_json(nlohmann::json &j,
const vpMe &me);
577 friend void from_json(
const nlohmann::json &j,
vpMe &me);
580 #ifdef VISP_HAVE_NLOHMANN_JSON
581 #include <nlohmann/json.hpp>
584 {vpMe::vpLikelihoodThresholdType::OLD_THRESHOLD,
"old"},
585 {vpMe::vpLikelihoodThresholdType::NORMALIZED_THRESHOLD,
"normalized"}
588 inline void to_json(nlohmann::json &j,
const vpMe &me)
608 inline void from_json(
const nlohmann::json &j,
vpMe &me)
610 if (j.contains(
"thresholdType")) {
617 if (j.contains(
"mu")) {
618 std::vector<double> mus = j.at(
"mu").get<std::vector<double>>();
619 assert((mus.size() == 2));
631 if (j.contains(
"angleStep") && j.contains(
"nMask")) {
632 std::cerr <<
"both angle step and number of masks are defined, number of masks will take precedence" << std::endl;
635 else if (j.contains(
"angleStep")) {
638 else if (j.contains(
"nMask")) {
error that can be emitted by ViSP classes.
@ badValue
Used to indicate that a value is not in the allowed range.
Implementation of a matrix and operations on matrices.
bool getUseAutomaticThreshold() const
Indicates if the contrast threshold of the vpMeSite is automatically computed.
void setMu1(const double &mu_1)
void setMinThreshold(const double &minThreshold)
void setPointsToTrack(const int &points_to_track)
vpLikelihoodThresholdType getLikelihoodThresholdType() const
double getMinSampleStep() const
void setMaskSign(const int &mask_sign)
void setRange(const unsigned int &range)
void setLikelihoodThresholdType(const vpLikelihoodThresholdType likelihood_threshold_type)
void setNbTotalSample(const int &ntotal_sample)
void setAngleStep(const unsigned int &anglestep)
void setMaskNumber(const unsigned int &mask_number)
int getNbTotalSample() const
void setThreshold(const double &threshold)
void setStrip(const int &strip)
void checkSamplestep(double &sample_step)
unsigned int getAngleStep() const
double getThresholdMarginRatio() const
void setMinSampleStep(const double &min_samplestep)
unsigned int getMaskNumber() const
int getPointsToTrack() const
void setSampleStep(const double &sample_step)
double getThreshold() const
unsigned int getMaskSize() const
void setMaskSize(const unsigned int &mask_size)
void setThresholdMarginRatio(const double &thresholdMarginRatio)
void setMu2(const double &mu_2)
vpMatrix * getMask() const
double getSampleStep() const
unsigned int getRange() const
vpLikelihoodThresholdType
double getMinThreshold() const