ViSP  2.8.0
vpMbtKltXmlParser.h
1 /****************************************************************************
2  *
3  * $Id: vpMbtKltXmlParser.h 4320 2013-07-17 15:37:27Z ayol $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Read MBT KLT Tracker information in an XML file
36  *
37  * Authors:
38  * Aurelien Yol
39  *
40  *****************************************************************************/
41 
46 #ifndef vpMbtKltXmlParser_HH
47 #define vpMbtKltXmlParser_HH
48 
49 #include <visp/vpConfig.h>
50 
51 #ifdef VISP_HAVE_XML2
52 
53 #include <libxml/xmlmemory.h> /* Fonctions de la lib XML. */
54 
55 #include <visp/vpXmlParser.h>
56 #include <visp/vpCameraParameters.h>
57 
66 class VISP_EXPORT vpMbtKltXmlParser: public vpXmlParser
67 {
68 protected:
70  unsigned int maskBorder;
72  unsigned int maxFeatures;
74  unsigned int winSize;
76  double qualityValue;
78  double minDist;
80  double harrisParam;
82  unsigned int blockSize;
84  unsigned int pyramidLevels;
86  double angleAppear;
92  double nearClipping;
96  double farClipping;
101 
102  typedef enum{
122  u0,
123  v0,
124  px,
125  py
126  } dataToParse;
127 
128 
129 public:
130 
132  virtual ~vpMbtKltXmlParser();
133 
139  inline double getAngleAppear() const {return angleAppear;}
140 
146  inline double getAngleDisappear() const {return angleDisappear;}
147 
153  inline unsigned int getBlockSize() const {return blockSize;}
154 
160  void getCameraParameters(vpCameraParameters& _cam) const { _cam = cam;}
161 
167  inline double getFarClippingDistance() const {return farClipping;}
168 
174  inline bool getFovClipping() const {return fovClipping;}
175 
181  inline double getHarrisParam() const {return harrisParam;}
182 
188  inline unsigned int getMaskBorder() const {return maskBorder;}
189 
195  inline unsigned int getMaxFeatures() const {return maxFeatures;}
196 
202  inline double getMinDistance() const {return minDist;}
203 
209  inline double getNearClippingDistance() const {return nearClipping;}
210 
216  inline unsigned int getPyramidLevels() const {return pyramidLevels;}
217 
223  inline double getQuality() const {return qualityValue;}
224 
230  inline unsigned int getWindowSize() const {return winSize;}
231 
237  inline bool hasFarClippingDistance() const {return hasFarClipping;}
238 
244  inline bool hasNearClippingDistance() const {return hasNearClipping;}
245 
246  void parse(const char * filename);
247 
248  void readMainClass(xmlDocPtr doc, xmlNodePtr node);
249  void read_camera (xmlDocPtr doc, xmlNodePtr node);
250  void read_klt(xmlDocPtr doc, xmlNodePtr node);
251  void read_face(xmlDocPtr doc, xmlNodePtr node);
252 
258  inline void setAngleAppear(const double &aappear) {angleAppear = aappear;}
259 
265  inline void setAngleDisappear(const double &adisappear) {angleDisappear = adisappear;}
266 
272  inline void setBlockSize(const unsigned int &bs) {blockSize = bs;}
273 
279  void setCameraParameters(const vpCameraParameters& _cam) {cam = _cam;}
280 
286  inline void setFarClippingDistance(const double &fclip) {farClipping = fclip;}
287 
293  inline void setHarrisParam(const double &hp) {harrisParam = hp;}
294 
300  inline void setMaskBorder(const unsigned int &mb) {maskBorder = mb;}
301 
307  inline void setMaxFeatures(const unsigned int &mF) {maxFeatures = mF;}
308 
314  inline void setMinDistance(const double &mD) {minDist = mD;}
315 
321  inline void setNearClippingDistance(const double &nclip) {nearClipping = nclip;}
322 
328  inline void setPyramidLevels(const unsigned int &pL) {pyramidLevels = pL;}
329 
335  inline void setQuality(const double &q) {qualityValue = q;}
336 
342  inline void setWindowSize(const unsigned int &w) {winSize = w;}
343 
344  void writeMainClass(xmlNodePtr node);
345 
346 protected:
347  void init();
348 
349 };
350 
351 #endif
352 
353 #endif
354 
355 
356 
unsigned int winSize
Windows size.
bool hasFarClippingDistance() const
unsigned int getMaskBorder() const
void setQuality(const double &q)
double getHarrisParam() const
double getFarClippingDistance() const
bool hasFarClipping
Is far clipping distance specified?
double minDist
Minimum distance between klt points.
unsigned int maskBorder
Border of the mask used on Klt points.
unsigned int getBlockSize() const
void getCameraParameters(vpCameraParameters &_cam) const
bool hasNearClipping
Is near clipping distance specified?
double angleAppear
Angle to determine if a face appeared.
double getAngleAppear() const
virtual void writeMainClass(xmlNodePtr node)=0
double getAngleDisappear() const
unsigned int getMaxFeatures() const
double harrisParam
Harris free parameters.
double farClipping
Near clipping distance.
bool fovClipping
Fov Clipping.
double angleDisappear
Angle to determine if a face disappeared.
unsigned int maxFeatures
Maximum of Klt features.
This class intends to simplify the creation of xml parser based on the libxml2 third party library...
Definition: vpXmlParser.h:178
void setCameraParameters(const vpCameraParameters &_cam)
void setNearClippingDistance(const double &nclip)
void setPyramidLevels(const unsigned int &pL)
Parse an Xml file to extract configuration parameters of a Mbt Klt object.Data parser for the KLT mod...
unsigned int getWindowSize() const
void setWindowSize(const unsigned int &w)
double nearClipping
Near clipping distance.
unsigned int pyramidLevels
Number of pyramid levels.
Generic class defining intrinsic camera parameters.
virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node)=0
void setAngleDisappear(const double &adisappear)
void setHarrisParam(const double &hp)
void setMinDistance(const double &mD)
void setAngleAppear(const double &aappear)
void setMaxFeatures(const unsigned int &mF)
unsigned int blockSize
Block size.
double getQuality() const
void setFarClippingDistance(const double &fclip)
double qualityValue
Quality of the Klt points.
void setBlockSize(const unsigned int &bs)
bool hasNearClippingDistance() const
double getMinDistance() const
bool getFovClipping() const
vpCameraParameters cam
Camera parameters.
double getNearClippingDistance() const
void setMaskBorder(const unsigned int &mb)
unsigned int getPyramidLevels() const
void parse(const std::string &filename)