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 VISP_NLOHMANN_JSON(json.hpp)
155 } vpLikelihoodThresholdType;
178#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
192 if (sample_step < m_min_samplestep) {
193 sample_step = m_min_samplestep;
255 inline double getMu1()
const {
return m_mu1; }
262 inline double getMu2()
const {
return m_mu2; }
283 inline unsigned int getRange()
const {
return m_range; }
360 void setAngleStep(
const unsigned int &anglestep) { m_anglestep = anglestep; }
368 inline void setInitRange(
const int &initRange) { m_init_range = initRange; }
377 void setMaskNumber(
const unsigned int &mask_number);
384 void setMaskSign(
const int &mask_sign) { m_mask_sign = mask_sign; }
393 void setMaskSize(
const unsigned int &mask_size);
408 void setMu1(
const double &mu_1) { this->m_mu1 = mu_1; }
415 void setMu2(
const double &mu_2) { this->m_mu2 = mu_2; }
438 void setRange(
const unsigned int &range) { m_range = range; }
445 void setSampleStep(
const double &sample_step) { m_sample_step = sample_step; }
452 void setStrip(
const int &strip) { m_strip = strip; }
489 void setThreshold(
const double &threshold) { m_threshold = threshold; }
502 if (thresholdMarginRatio > 1.) {
503 throw(
vpException(
vpException::badValue,
"Threshold margin ratio must be between 0 and 1 if you want to use automatic threshold computation, or negative otherwise"));
505 m_thresholdMarginRatio = thresholdMarginRatio;
506 m_useAutomaticThreshold = (m_thresholdMarginRatio > 0) && (m_minThreshold > 0);
519 m_minThreshold = minThreshold;
520 m_useAutomaticThreshold = (m_thresholdMarginRatio > 0) && (m_minThreshold > 0);
534 vpLikelihoodThresholdType m_likelihood_threshold_type;
537 double m_thresholdMarginRatio;
538 double m_minThreshold;
539 bool m_useAutomaticThreshold;
542 double m_min_samplestep;
543 unsigned int m_anglestep;
546 unsigned int m_range;
547 double m_sample_step;
549 int m_points_to_track;
551 unsigned int m_mask_size;
553 unsigned int m_mask_number;
559#ifdef VISP_HAVE_NLOHMANN_JSON
566 friend void to_json(nlohmann::json &j,
const vpMe &me);
615 friend void from_json(
const nlohmann::json &j,
vpMe &me);
619#ifdef VISP_HAVE_NLOHMANN_JSON
621#if defined(__clang__)
624# pragma clang diagnostic push
625# pragma clang diagnostic ignored "-Wexit-time-destructors"
633#if defined(__clang__)
634# pragma clang diagnostic pop
660 if (j.contains(
"thresholdType")) {
667 if (j.contains(
"mu")) {
668 std::vector<double> mus = j.at(
"mu").get<std::vector<double>>();
669 assert((mus.size() == 2));
682 if (j.contains(
"angleStep") && j.contains(
"nMask")) {
683 std::cerr <<
"both angle step and number of masks are defined, number of masks will take precedence" << std::endl;
686 else if (j.contains(
"angleStep")) {
689 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)
friend void to_json(nlohmann::json &j, const vpMe &me)
Convert a vpMe object to a JSON representation.
friend void from_json(const nlohmann::json &j, vpMe &me)
Retrieve a vpMe object from a JSON representation.
vpLikelihoodThresholdType getLikelihoodThresholdType() const
double getMinSampleStep() const
void setInitRange(const int &initRange)
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)
vpMatrix * getMask() const
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)
double getSampleStep() const
unsigned int getRange() const
vpLikelihoodThresholdType
@ OLD_THRESHOLD
Old likelihood ratio threshold (to be avoided).
double getMinThreshold() const