40 #include <visp3/core/vpIoTools.h>
41 #include <visp3/mbt/vpMbtXmlGenericParser.h>
45 #ifdef ENABLE_VISP_NAMESPACE
48 #if defined(VISP_HAVE_PUGIXML) && (defined(VISP_HAVE_LAPACK) || defined(VISP_HAVE_EIGEN3) || defined(VISP_HAVE_OPENCV))
51 double eps = std::numeric_limits<double>::epsilon();
53 std::string filename = visp_images_dir +
"/xml/chateau.xml";
55 std::cout <<
"Parse config: " << filename << std::endl;
83 std::cerr <<
"Issue when parsing xml: " << filename <<
" (ME)" << std::endl;
87 if (xml.getKltMaskBorder() != 5 || xml.getKltMaxFeatures() != 10000 || xml.getKltWindowSize() != 5 ||
89 !
vpMath::equal(xml.getKltHarrisParam(), 0.02, eps) || xml.getKltBlockSize() != 3 ||
90 xml.getKltPyramidLevels() != 3) {
91 std::cerr <<
"Issue when parsing xml: " << filename <<
" (KLT)" << std::endl;
98 xml.getCameraParameters(cam);
100 std::cerr <<
"Issue when parsing xml: " << filename <<
" (cam)" << std::endl;
106 !
vpMath::equal(xml.getFarClippingDistance(), 2, eps) || !xml.getFovClipping()) {
107 std::cerr <<
"Issue when parsing xml: " << filename <<
" (visibility)" << std::endl;
113 std::string filename = visp_images_dir +
"/xml/chateau.xml";
115 std::cout <<
"Parse config: " << filename << std::endl;
118 xml.getProjectionErrorMe(me_proj);
120 std::cerr <<
"Issue when parsing xml: " << filename <<
" (projection error)" << std::endl;
126 std::string filename = visp_images_dir +
"/xml/chateau_depth.xml";
128 std::cout <<
"Parse config: " << filename << std::endl;
131 if (xml.getDepthNormalFeatureEstimationMethod() != 0 || xml.getDepthNormalPclPlaneEstimationMethod() != 2 ||
132 xml.getDepthNormalPclPlaneEstimationRansacMaxIter() != 200 ||
133 !
vpMath::equal(xml.getDepthNormalPclPlaneEstimationRansacThreshold(), 0.001, eps) ||
134 xml.getDepthNormalSamplingStepX() != 2 || xml.getDepthNormalSamplingStepY() != 2) {
135 std::cerr <<
"Issue when parsing xml: " << filename <<
" (depth normal)" << std::endl;
139 if (xml.getDepthDenseSamplingStepX() != 4 || xml.getDepthDenseSamplingStepY() != 4) {
140 std::cerr <<
"Issue when parsing xml: " << filename <<
" (depth dense)" << std::endl;
147 xml.getCameraParameters(cam);
148 if (cam != cam_ref) {
149 std::cerr <<
"Issue when parsing xml: " << filename <<
" (cam)" << std::endl;
155 !
vpMath::equal(xml.getFarClippingDistance(), 2, eps) || !xml.getFovClipping()) {
156 std::cerr <<
"Issue when parsing xml: " << filename <<
" (visibility)" << std::endl;
161 #elif !(defined(VISP_HAVE_LAPACK) || defined(VISP_HAVE_EIGEN3) || defined(VISP_HAVE_OPENCV))
162 std::cout <<
"Cannot run this example: install Lapack, Eigen3 or OpenCV" << std::endl;
163 #elif !(defined(VISP_HAVE_PUGIXML))
164 std::cout <<
"Cannot run this example: enable pugixml built-in" << std::endl;
167 std::cout <<
"Test succeed" << std::endl;
Generic class defining intrinsic camera parameters.
void initPersProjWithoutDistortion(double px, double py, double u0, double v0)
static bool equal(double x, double y, double threshold=0.001)
Parse an Xml file to extract configuration parameters of a mbtConfig object.
@ PROJECTION_ERROR_PARSER
void setMu1(const double &mu_1)
vpLikelihoodThresholdType getLikelihoodThresholdType() const
void setRange(const unsigned int &range)
void setLikelihoodThresholdType(const vpLikelihoodThresholdType likelihood_threshold_type)
void setMaskNumber(const unsigned int &mask_number)
void setThreshold(const double &threshold)
unsigned int getMaskNumber() const
void setSampleStep(const double &sample_step)
double getThreshold() const
unsigned int getMaskSize() const
void setMaskSize(const unsigned int &mask_size)
void setMu2(const double &mu_2)
double getSampleStep() const
unsigned int getRange() const
@ OLD_THRESHOLD
Old likelihood ratio threshold (to be avoided).