Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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
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 
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 {
155  return useLod;
156  }
157 
163  inline double getMinLineLengthThreshold() const {
164  return minLineLengthThreshold;
165  }
166 
172  inline double getMinPolygonAreaThreshold() const {
173  return minPolygonAreaThreshold;
174  }
175 
181  inline double getNearClippingDistance() const {return nearClipping;}
182 
188  inline bool hasFarClippingDistance() const {return hasFarClipping;}
189 
195  inline bool hasNearClippingDistance() const {return hasNearClipping;}
196 
197  void parse(const char * filename);
198 
199  virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node);
200  void read_camera (xmlDocPtr doc, xmlNodePtr node);
201  void read_face(xmlDocPtr doc, xmlNodePtr node);
202  void read_lod (xmlDocPtr doc, xmlNodePtr node);
203 
209  inline void setAngleAppear(const double &aappear) {angleAppear = aappear;}
210 
216  inline void setAngleDisappear(const double &adisappear) {angleDisappear = adisappear;}
217 
218  void setCameraParameters(const vpCameraParameters &_cam){ cam = _cam; }
219 
225  inline void setFarClippingDistance(const double &fclip) {farClipping = fclip;}
226 
232  inline void setNearClippingDistance(const double &nclip) {nearClipping = nclip;}
233 
234  void writeMainClass(xmlNodePtr node);
236 
237 protected:
240  void init();
242 
243 };
244 
245 #endif
246 
247 #endif /* NMBXMLPARSER_H_ */
248 
249 
250 
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:175
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)