1 /**************************************************************************** 2 * 3 * ViSP, open source Visual Servoing Platform software. 4 * Copyright (C) 2005 - 2019 by Inria. All rights reserved. 5 * 6 * This software is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * See the file LICENSE.txt at the root directory of this source 11 * distribution for additional information about the GNU GPL. 12 * 13 * For using ViSP with software that can not be combined with the GNU 14 * GPL, please contact Inria about acquiring a ViSP Professional 15 * Edition License. 16 * 17 * See http://visp.inria.fr for more information. 18 * 19 * This software was developed at: 20 * Inria Rennes - Bretagne Atlantique 21 * Campus Universitaire de Beaulieu 22 * 35042 Rennes Cedex 23 * France 24 * 25 * If you have questions regarding the use of this file, please contact 26 * Inria at visp@inria.fr 27 * 28 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 29 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 30 * 31 * Description: 32 * Load XML Parameter for Model Based Tracker. 33 * 34 *****************************************************************************/ 35 36 /*! 37 * \file vpMbtXmlGenericParser.h 38 * \brief Parse an Xml file to extract configuration parameters of a mbtConfig 39 * object. 40 */ 41 42 #ifndef _vpMbtXmlGenericParser_h_ 43 #define _vpMbtXmlGenericParser_h_ 44 45 #include <visp3/core/vpConfig.h> 46 47 #include <visp3/core/vpCameraParameters.h> 48 #include <visp3/mbt/vpMbtFaceDepthNormal.h> 49 #include <visp3/me/vpMe.h> 50 51 /*! 52 \class vpMbtXmlGenericParser 53 \brief Parse an Xml file to extract configuration parameters of a mbtConfig 54 object. 55 \ingroup group_mbt_xml_parser 56 57 Data parser for the model-based tracker. 58 59 */ 60 class VISP_EXPORT vpMbtXmlGenericParser 61 { 62 public: 63 enum vpParserType { 64 EDGE_PARSER = 1 << 0, /*!< Parser for model-based tracking using moving 65 edges features. */ 66 KLT_PARSER = 1 << 1, /*!< Parser for model-based tracking using KLT features. */ 67 DEPTH_NORMAL_PARSER = 1 << 2, /*!< Parser for model-based tracking using 68 depth normal features. */ 69 DEPTH_DENSE_PARSER = 1 << 3, /*!< Parser for model-based tracking using 70 depth dense features. */ 71 PROJECTION_ERROR_PARSER = 0 /*!< Parser for projection error computation parameters. */ 72 }; 73 74 public: 75 vpMbtXmlGenericParser(int type = EDGE_PARSER); 76 virtual ~vpMbtXmlGenericParser(); 77 78 double getAngleAppear() const; 79 double getAngleDisappear() const; 80 81 void getCameraParameters(vpCameraParameters &cam) const; 82 83 void getEdgeMe(vpMe &ecm) const; 84 85 unsigned int getDepthDenseSamplingStepX() const; 86 unsigned int getDepthDenseSamplingStepY() const; 87 88 vpMbtFaceDepthNormal::vpFeatureEstimationType getDepthNormalFeatureEstimationMethod() const; 89 int getDepthNormalPclPlaneEstimationMethod() const; 90 int getDepthNormalPclPlaneEstimationRansacMaxIter() const; 91 double getDepthNormalPclPlaneEstimationRansacThreshold() const; 92 unsigned int getDepthNormalSamplingStepX() const; 93 unsigned int getDepthNormalSamplingStepY() const; 94 95 double getFarClippingDistance() const; 96 bool getFovClipping() const; 97 98 unsigned int getKltBlockSize() const; 99 double getKltHarrisParam() const; 100 unsigned int getKltMaskBorder() const; 101 unsigned int getKltMaxFeatures() const; 102 double getKltMinDistance() const; 103 unsigned int getKltPyramidLevels() const; 104 double getKltQuality() const; 105 unsigned int getKltWindowSize() const; 106 107 bool getLodState() const; 108 double getLodMinLineLengthThreshold() const; 109 double getLodMinPolygonAreaThreshold() const; 110 111 double getNearClippingDistance() const; 112 113 void getProjectionErrorMe(vpMe &me) const; 114 115 unsigned int getProjectionErrorKernelSize() const; 116 117 bool hasFarClippingDistance() const; 118 bool hasNearClippingDistance() const; 119 120 void parse(const std::string &filename); 121 122 void setAngleAppear(const double &aappear); 123 void setAngleDisappear(const double &adisappear); 124 125 void setCameraParameters(const vpCameraParameters &cam); 126 127 void setDepthDenseSamplingStepX(unsigned int stepX); 128 void setDepthDenseSamplingStepY(unsigned int stepY); 129 130 void setDepthNormalFeatureEstimationMethod(const vpMbtFaceDepthNormal::vpFeatureEstimationType &method); 131 void setDepthNormalPclPlaneEstimationMethod(int method); 132 void setDepthNormalPclPlaneEstimationRansacMaxIter(int maxIter); 133 void setDepthNormalPclPlaneEstimationRansacThreshold(double threshold); 134 void setDepthNormalSamplingStepX(unsigned int stepX); 135 void setDepthNormalSamplingStepY(unsigned int stepY); 136 137 void setEdgeMe(const vpMe &ecm); 138 139 void setFarClippingDistance(const double &fclip); 140 141 void setKltBlockSize(const unsigned int &bs); 142 void setKltHarrisParam(const double &hp); 143 void setKltMaskBorder(const unsigned int &mb); 144 void setKltMaxFeatures(const unsigned int &mF); 145 void setKltMinDistance(const double &mD); 146 void setKltPyramidLevels(const unsigned int &pL); 147 void setKltQuality(const double &q); 148 void setKltWindowSize(const unsigned int &w); 149 150 void setNearClippingDistance(const double &nclip); 151 152 void setProjectionErrorMe(const vpMe &me); 153 void setProjectionErrorKernelSize(const unsigned int &size); 154 155 void setVerbose(bool verbose); 156 157 private: 158 vpMbtXmlGenericParser(const vpMbtXmlGenericParser &); // noncopyable 159 vpMbtXmlGenericParser &operator=(const vpMbtXmlGenericParser &); // 160 161 // PIMPL idiom 162 class Impl; 163 Impl *m_impl; 164 }; 165 166 #endif 167