Visual Servoing Platform  version 3.1.0
vpXmlConfigParserKeyPoint.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 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  * XML parser to load configuration for vpKeyPoint class.
33  *
34  * Authors:
35  * Souriya Trinh
36  *
37  *****************************************************************************/
38 
47 #ifndef __vpXmlConfigParserKeyPoint_h__
48 #define __vpXmlConfigParserKeyPoint_h__
49 
50 #include <visp3/core/vpConfig.h>
51 
52 #ifdef VISP_HAVE_XML2
53 
54 #include <iostream>
55 #include <stdlib.h>
56 
57 #include <libxml/xmlmemory.h> // Functions of libxml.
58 
59 #include <visp3/core/vpXmlParser.h>
60 
70 class VISP_EXPORT vpXmlConfigParserKeyPoint : public vpXmlParser
71 {
72 
73 public:
75  typedef enum {
76  conf,
80  name,
82  constant_factor_distance_threshold,
85  std_distance_threshold,
87  ratio_distance_threshold,
89  std_and_ratio_distance_threshold,
92  no_filter_matching,
94  matching_factor_threshold,
96  matching_ratio_threshold,
100  use_ransac_consensus_percentage,
103  nb_ransac_iterations,
105  ransac_reprojection_error,
107  nb_ransac_min_inlier_count,
109  ransac_threshold,
111  ransac_consensus_percentage
114 
116  typedef enum {
117  constantFactorDistanceThreshold,
119  stdDistanceThreshold,
122  stdAndRatioDistanceThreshold,
124  noFilterMatching
126 
127 private:
129  std::string m_detectorName;
131  std::string m_extractorName;
133  std::string m_matcherName;
135  double m_matchingFactorThreshold;
137  vpMatchingMethodEnum m_matchingMethod;
139  double m_matchingRatioThreshold;
141  int m_nbRansacIterations;
143  int m_nbRansacMinInlierCount;
145  double m_ransacConsensusPercentage;
148  double m_ransacReprojectionError;
151  double m_ransacThreshold;
154  // it is based on a fixed number.
155  bool m_useRansacConsensusPercentage;
158  bool m_useRansacVVS;
159 
160 public:
164 
170  inline std::string getDetectorName() const { return m_detectorName; }
171 
177  inline std::string getExtractorName() const { return m_extractorName; }
183  inline std::string getMatcherName() const { return m_matcherName; }
190  inline double getMatchingFactorThreshold() const { return m_matchingFactorThreshold; }
191 
197  inline vpMatchingMethodEnum getMatchingMethod() const { return m_matchingMethod; }
198 
204  inline double getMatchingRatioThreshold() const { return m_matchingRatioThreshold; }
205 
211  inline int getNbRansacIterations() const { return m_nbRansacIterations; }
212 
218  inline int getNbRansacMinInlierCount() const { return m_nbRansacMinInlierCount; }
219 
225  inline double getRansacConsensusPercentage() const { return m_ransacConsensusPercentage; }
226 
233  inline double getRansacReprojectionError() const { return m_ransacReprojectionError; }
234 
240  inline double getRansacThreshold() const { return m_ransacThreshold; }
241 
248  inline bool getUseRansacConsensusPercentage() const { return m_useRansacConsensusPercentage; }
249 
256  inline bool getUseRansacVVSPoseEstimation() const { return m_useRansacVVS; }
257 
263  void parse(const std::string &filename);
264 
265 private:
266  void init();
267  void read_detector(xmlDocPtr doc, xmlNodePtr node);
268  void read_extractor(xmlDocPtr doc, xmlNodePtr node);
269  void read_matcher(xmlDocPtr doc, xmlNodePtr node);
270  virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node);
271  void read_ransac(xmlDocPtr doc, xmlNodePtr node);
272  virtual void writeMainClass(xmlNodePtr){};
273 };
274 #endif // VISP_HAVE_XML2
275 #endif
virtual void writeMainClass(xmlNodePtr node)=0
This class intends to simplify the creation of xml parser based on the libxml2 third party library...
Definition: vpXmlParser.h:177
virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node)=0
virtual ~vpXmlConfigParserKeyPoint()
Default destructor.
vpMatchingMethodEnum getMatchingMethod() const
void parse(const std::string &filename)