Visual Servoing Platform  version 3.1.0
vpMbXmlParser.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  * Load XML Parameter for Model Based Tracker.
33  *
34  * Authors:
35  * Aurelien Yol
36  *
37  *****************************************************************************/
38 
45 #ifndef vpMbXmlParser_HH
46 #define vpMbXmlParser_HH
47 
48 #include <visp3/core/vpConfig.h>
49 
50 #ifdef VISP_HAVE_XML2
51 
52 #include <libxml/xmlmemory.h> /* Fonctions de la lib XML. */
53 
54 #include <visp3/core/vpCameraParameters.h>
55 #include <visp3/core/vpXmlParser.h>
56 
65 class VISP_EXPORT vpMbXmlParser : public vpXmlParser
66 {
67 protected:
71  double angleAppear;
77  double nearClipping;
81  double farClipping;
85  bool useLod;
90 
91  typedef enum {
102  u0,
103  v0,
104  px,
105  py,
110  last
111  } dataToParseMb;
112 
113 public:
116  vpMbXmlParser();
117  virtual ~vpMbXmlParser();
118 
124  inline double getAngleAppear() const { return angleAppear; }
125 
131  inline double getAngleDisappear() const { return angleDisappear; }
132 
133  void getCameraParameters(vpCameraParameters &_cam) const { _cam = this->cam; }
134 
140  inline double getFarClippingDistance() const { return farClipping; }
141 
147  inline bool getFovClipping() const { return fovClipping; }
148 
154  inline bool getLodState() const { return useLod; }
155 
161  inline double getMinLineLengthThreshold() const { return minLineLengthThreshold; }
162 
168  inline double getMinPolygonAreaThreshold() const { return minPolygonAreaThreshold; }
169 
175  inline double getNearClippingDistance() const { return nearClipping; }
176 
182  inline bool hasFarClippingDistance() const { return hasFarClipping; }
183 
189  inline bool hasNearClippingDistance() const { return hasNearClipping; }
190 
191  void parse(const char *filename);
192 
193  virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node);
194  void read_camera(xmlDocPtr doc, xmlNodePtr node);
195  void read_face(xmlDocPtr doc, xmlNodePtr node);
196  void read_lod(xmlDocPtr doc, xmlNodePtr node);
197 
203  inline void setAngleAppear(const double &aappear) { angleAppear = aappear; }
204 
210  inline void setAngleDisappear(const double &adisappear) { angleDisappear = adisappear; }
211 
212  void setCameraParameters(const vpCameraParameters &_cam) { cam = _cam; }
213 
219  inline void setFarClippingDistance(const double &fclip) { farClipping = fclip; }
220 
226  inline void setNearClippingDistance(const double &nclip) { nearClipping = nclip; }
227 
228  void writeMainClass(xmlNodePtr node);
230 
231 protected:
234  void init();
236 };
237 
238 #endif
239 
240 #endif /* NMBXMLPARSER_H_ */
bool getFovClipping() const
vpCameraParameters cam
Camera parameters.
Definition: vpMbXmlParser.h:69
double getAngleAppear() const
double nearClipping
Near clipping distance.
Definition: vpMbXmlParser.h:77
double angleAppear
Angle to determine if a face appeared.
Definition: vpMbXmlParser.h:71
double minLineLengthThreshold
Minimum line length to track a segment when LOD is enabled.
Definition: vpMbXmlParser.h:87
virtual void writeMainClass(xmlNodePtr node)=0
void getCameraParameters(vpCameraParameters &_cam) const
bool hasFarClipping
Is far clipping distance specified?
Definition: vpMbXmlParser.h:79
bool hasNearClippingDistance() const
bool getLodState() const
double angleDisappear
Angle to determine if a face disappeared.
Definition: vpMbXmlParser.h:73
This class intends to simplify the creation of xml parser based on the libxml2 third party library...
Definition: vpXmlParser.h:177
double getAngleDisappear() const
double farClipping
Near clipping distance.
Definition: vpMbXmlParser.h:81
double getNearClippingDistance() const
double getFarClippingDistance() const
void setAngleDisappear(const double &adisappear)
Generic class defining intrinsic camera parameters.
virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node)=0
void setCameraParameters(const vpCameraParameters &_cam)
bool hasNearClipping
Is near clipping distance specified?
Definition: vpMbXmlParser.h:75
Parse an Xml file to extract configuration parameters of a mbtConfig object.Data parser for the model...
Definition: vpMbXmlParser.h:65
void setNearClippingDistance(const double &nclip)
double getMinPolygonAreaThreshold() const
void setAngleAppear(const double &aappear)
bool hasFarClippingDistance() const
double getMinLineLengthThreshold() const
bool fovClipping
Fov Clipping.
Definition: vpMbXmlParser.h:83
void setFarClippingDistance(const double &fclip)
double minPolygonAreaThreshold
Minimum polygon area to track a face when LOD is enabled.
Definition: vpMbXmlParser.h:89
bool useLod
If true, the LOD is enabled, otherwise it is not.
Definition: vpMbXmlParser.h:85
void parse(const std::string &filename)