Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
vpMbXmlParser.h
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  * 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  virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node);
192  void read_camera(xmlDocPtr doc, xmlNodePtr node);
193  void read_face(xmlDocPtr doc, xmlNodePtr node);
194  void read_lod(xmlDocPtr doc, xmlNodePtr node);
195 
201  inline void setAngleAppear(const double &aappear) { angleAppear = aappear; }
202 
208  inline void setAngleDisappear(const double &adisappear) { angleDisappear = adisappear; }
209 
210  void setCameraParameters(const vpCameraParameters &_cam) { cam = _cam; }
211 
217  inline void setFarClippingDistance(const double &fclip) { farClipping = fclip; }
218 
224  inline void setNearClippingDistance(const double &nclip) { nearClipping = nclip; }
225 
226  void writeMainClass(xmlNodePtr node);
228 
229 protected:
232  void init();
234 };
235 
236 #endif
237 
238 #endif /* NMBXMLPARSER_H_ */
vpCameraParameters cam
Camera parameters.
Definition: vpMbXmlParser.h:69
void getCameraParameters(vpCameraParameters &_cam) const
double nearClipping
Near clipping distance.
Definition: vpMbXmlParser.h:77
double angleAppear
Angle to determine if a face appeared.
Definition: vpMbXmlParser.h:71
double getNearClippingDistance() const
double minLineLengthThreshold
Minimum line length to track a segment when LOD is enabled.
Definition: vpMbXmlParser.h:87
virtual void writeMainClass(xmlNodePtr node)=0
bool getLodState() const
bool hasFarClipping
Is far clipping distance specified?
Definition: vpMbXmlParser.h:79
double angleDisappear
Angle to determine if a face disappeared.
Definition: vpMbXmlParser.h:73
bool hasNearClippingDistance() const
This class intends to simplify the creation of xml parser based on the libxml2 third party library...
Definition: vpXmlParser.h:177
double getFarClippingDistance() const
bool hasFarClippingDistance() const
double farClipping
Near clipping distance.
Definition: vpMbXmlParser.h:81
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: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 getMinLineLengthThreshold() const
void setAngleAppear(const double &aappear)
bool fovClipping
Fov Clipping.
Definition: vpMbXmlParser.h:83
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:89
bool useLod
If true, the LOD is enabled, otherwise it is not.
Definition: vpMbXmlParser.h:85