Visual Servoing Platform  version 3.0.0
vpMbXmlParser.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Load XML Parameter for Model Based Tracker.
32  *
33  * Authors:
34  * Aurelien Yol
35  *
36  *****************************************************************************/
37 
43 #ifndef vpMbXmlParser_HH
44 #define vpMbXmlParser_HH
45 
46 #include <visp3/core/vpConfig.h>
47 
48 #ifdef VISP_HAVE_XML2
49 
50 #include <libxml/xmlmemory.h> /* Fonctions de la lib XML. */
51 
52 #include <visp3/core/vpXmlParser.h>
53 #include <visp3/core/vpCameraParameters.h>
54 
63 class VISP_EXPORT vpMbXmlParser: public vpXmlParser
64 {
65 protected:
69  double angleAppear;
75  double nearClipping;
79  double farClipping;
83  bool useLod;
88 
89  typedef enum{
100  u0,
101  v0,
102  px,
103  py,
108  last
109  } dataToParseMb;
110 
111 
112 public:
113 
114  vpMbXmlParser();
115  virtual ~vpMbXmlParser();
116 
122  inline double getAngleAppear() const {return angleAppear;}
123 
129  inline double getAngleDisappear() const {return angleDisappear;}
130 
131  void getCameraParameters(vpCameraParameters& _cam) const { _cam = this->cam;}
132 
138  inline double getFarClippingDistance() const {return farClipping;}
139 
145  inline bool getFovClipping() const {return fovClipping;}
146 
152  inline bool getLodState() const {
153  return useLod;
154  }
155 
161  inline double getMinLineLengthThreshold() const {
162  return minLineLengthThreshold;
163  }
164 
170  inline double getMinPolygonAreaThreshold() const {
171  return minPolygonAreaThreshold;
172  }
173 
179  inline double getNearClippingDistance() const {return nearClipping;}
180 
186  inline bool hasFarClippingDistance() const {return hasFarClipping;}
187 
193  inline bool hasNearClippingDistance() const {return hasNearClipping;}
194 
195  void parse(const char * filename);
196 
197  virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node);
198  void read_camera (xmlDocPtr doc, xmlNodePtr node);
199  void read_face(xmlDocPtr doc, xmlNodePtr node);
200  void read_lod (xmlDocPtr doc, xmlNodePtr node);
201 
207  inline void setAngleAppear(const double &aappear) {angleAppear = aappear;}
208 
214  inline void setAngleDisappear(const double &adisappear) {angleDisappear = adisappear;}
215 
216  void setCameraParameters(const vpCameraParameters &_cam){ cam = _cam; }
217 
223  inline void setFarClippingDistance(const double &fclip) {farClipping = fclip;}
224 
230  inline void setNearClippingDistance(const double &nclip) {nearClipping = nclip;}
231 
232  void writeMainClass(xmlNodePtr node);
233 
234 protected:
235  void init();
236 
237 };
238 
239 #endif
240 
241 #endif /* NMBXMLPARSER_H_ */
242 
243 
244 
vpCameraParameters cam
Camera parameters.
Definition: vpMbXmlParser.h:67
void getCameraParameters(vpCameraParameters &_cam) const
double nearClipping
Near clipping distance.
Definition: vpMbXmlParser.h:75
double angleAppear
Angle to determine if a face appeared.
Definition: vpMbXmlParser.h:69
double getNearClippingDistance() const
double minLineLengthThreshold
Minimum line length to track a segment when LOD is enabled.
Definition: vpMbXmlParser.h:85
virtual void writeMainClass(xmlNodePtr node)=0
bool getLodState() const
bool hasFarClipping
Is far clipping distance specified?
Definition: vpMbXmlParser.h:77
double angleDisappear
Angle to determine if a face disappeared.
Definition: vpMbXmlParser.h:71
bool hasNearClippingDistance() const
This class intends to simplify the creation of xml parser based on the libxml2 third party library...
Definition: vpXmlParser.h:174
double getFarClippingDistance() const
bool hasFarClippingDistance() const
double farClipping
Near clipping distance.
Definition: vpMbXmlParser.h:79
double getAngleDisappear() const
void setAngleDisappear(const double &adisappear)
double getMinPolygonAreaThreshold() const
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:73
Parse an Xml file to extract configuration parameters of a mbtConfig object.Data parser for the model...
Definition: vpMbXmlParser.h:63
void setNearClippingDistance(const double &nclip)
double getMinLineLengthThreshold() const
void setAngleAppear(const double &aappear)
bool fovClipping
Fov Clipping.
Definition: vpMbXmlParser.h:81
double getAngleAppear() const
bool getFovClipping() const
void setFarClippingDistance(const double &fclip)
double minPolygonAreaThreshold
Minimum polygon area to track a face when LOD is enabled.
Definition: vpMbXmlParser.h:87
bool useLod
If true, the LOD is enabled, otherwise it is not.
Definition: vpMbXmlParser.h:83
void parse(const std::string &filename)