42 #include <visp3/core/vpConfig.h>
43 #include <visp3/core/vpImage.h>
44 #include <visp3/core/vpMath.h>
45 #include <visp3/core/vpMatrix.h>
47 #ifdef VISP_HAVE_NLOHMANN_JSON
48 #include <nlohmann/json.hpp>
145 NORMALIZED_THRESHOLD = 1
146 } vpLikelihoodThresholdType;
169 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
183 if (sample_step < m_min_samplestep) {
184 sample_step = m_min_samplestep;
240 inline double getMu1()
const {
return m_mu1; }
247 inline double getMu2()
const {
return m_mu2; }
268 inline unsigned int getRange()
const {
return m_range; }
345 void setAngleStep(
const unsigned int &anglestep) { m_anglestep = anglestep; }
354 void setMaskNumber(
const unsigned int &mask_number);
361 void setMaskSign(
const int &mask_sign) { m_mask_sign = mask_sign; }
370 void setMaskSize(
const unsigned int &mask_size);
385 void setMu1(
const double &mu_1) { this->m_mu1 = mu_1; }
392 void setMu2(
const double &mu_2) { this->m_mu2 = mu_2; }
415 void setRange(
const unsigned int &range) { m_range = range; }
422 void setSampleStep(
const double &sample_step) { m_sample_step = sample_step; }
429 void setStrip(
const int &strip) { m_strip = strip; }
466 void setThreshold(
const double &threshold) { m_threshold = threshold; }
477 if (thresholdMarginRatio > 1.) {
478 throw(
vpException(
vpException::badValue,
"Threshold margin ratio must be between 0 and 1 if you want to use automatic threshold computation, or negative otherwise"));
480 m_thresholdMarginRatio = thresholdMarginRatio;
481 m_useAutomaticThreshold = (m_thresholdMarginRatio > 0) && (m_minThreshold > 0);
493 m_minThreshold = minThreshold;
494 m_useAutomaticThreshold = (m_thresholdMarginRatio > 0) && (m_minThreshold > 0);
508 vpLikelihoodThresholdType m_likelihood_threshold_type;
511 double m_thresholdMarginRatio;
512 double m_minThreshold;
513 bool m_useAutomaticThreshold;
516 double m_min_samplestep;
517 unsigned int m_anglestep;
519 unsigned int m_range;
520 double m_sample_step;
522 int m_points_to_track;
524 unsigned int m_mask_size;
526 unsigned int m_mask_number;
532 #ifdef VISP_HAVE_NLOHMANN_JSON
539 friend void to_json(nlohmann::json &j,
const vpMe &me);
588 friend void from_json(
const nlohmann::json &j,
vpMe &me);
592 #ifdef VISP_HAVE_NLOHMANN_JSON
594 {vpMe::vpLikelihoodThresholdType::OLD_THRESHOLD,
"old"},
595 {vpMe::vpLikelihoodThresholdType::NORMALIZED_THRESHOLD,
"normalized"}
598 inline void to_json(nlohmann::json &j,
const vpMe &me)
618 inline void from_json(
const nlohmann::json &j,
vpMe &me)
620 if (j.contains(
"thresholdType")) {
627 if (j.contains(
"mu")) {
628 std::vector<double> mus = j.at(
"mu").get<std::vector<double>>();
629 assert((mus.size() == 2));
641 if (j.contains(
"angleStep") && j.contains(
"nMask")) {
642 std::cerr <<
"both angle step and number of masks are defined, number of masks will take precedence" << std::endl;
645 else if (j.contains(
"angleStep")) {
648 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