41 #include <visp3/core/vpConfig.h> 48 #include <libxml/xmlmemory.h> 50 #include <visp3/mbt/vpMbtXmlParser.h> 92 std::string file = filename;
115 bool camera_node =
false;
116 bool face_node =
false;
117 bool ecm_node =
false;
118 bool lod_node =
false;
120 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
121 if (dataNode->type == XML_ELEMENT_NODE) {
122 std::map<std::string, int>::iterator iter_data = this->
nodeMap.find((
char *)dataNode->name);
123 if (iter_data !=
nodeMap.end()) {
124 switch (iter_data->second) {
154 std::cout <<
"camera : u0 : " << this->
cam.
get_u0() <<
" (default)" << std::endl;
155 std::cout <<
"camera : v0 : " << this->
cam.
get_v0() <<
" (default)" << std::endl;
156 std::cout <<
"camera : px : " << this->
cam.
get_px() <<
" (default)" << std::endl;
157 std::cout <<
"camera : py : " << this->
cam.
get_py() <<
" (default)" << std::endl;
161 std::cout <<
"face : Angle Appear : " <<
angleAppear <<
" (default)" << std::endl;
162 std::cout <<
"face : Angle Disappear : " <<
angleDisappear <<
" (default)" << std::endl;
166 std::cout <<
"ecm : mask : size : " << this->
m_ecm.
getMaskSize() <<
" (default)" << std::endl;
167 std::cout <<
"ecm : mask : nb_mask : " << this->
m_ecm.
getMaskNumber() <<
" (default)" << std::endl;
168 std::cout <<
"ecm : range : tracking : " << this->
m_ecm.
getRange() <<
" (default)" << std::endl;
169 std::cout <<
"ecm : contrast : threshold : " << this->
m_ecm.
getThreshold() <<
" (default)" << std::endl;
170 std::cout <<
"ecm : contrast : mu1 : " << this->
m_ecm.
getMu1() <<
" (default)" << std::endl;
171 std::cout <<
"ecm : contrast : mu2 : " << this->
m_ecm.
getMu2() <<
" (default)" << std::endl;
172 std::cout <<
"ecm : sample : sample_step : " << this->
m_ecm.
getSampleStep() <<
" (default)" << std::endl;
176 std::cout <<
"lod : use lod : " <<
useLod <<
" (default)" << std::endl;
192 bool mask_node =
false;
193 bool range_node =
false;
194 bool contrast_node =
false;
195 bool sample_node =
false;
197 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
198 if (dataNode->type == XML_ELEMENT_NODE) {
199 std::map<std::string, int>::iterator iter_data = this->
nodeMap.find((
char *)dataNode->name);
200 if (iter_data !=
nodeMap.end()) {
201 switch (iter_data->second) {
212 contrast_node =
true;
228 std::cout <<
"ecm : mask : size : " << this->
m_ecm.
getMaskSize() <<
" (default)" << std::endl;
229 std::cout <<
"ecm : mask : nb_mask : " << this->
m_ecm.
getMaskNumber() <<
" (default)" << std::endl;
233 std::cout <<
"ecm : range : tracking : " << this->
m_ecm.
getRange() <<
" (default)" << std::endl;
236 if (!contrast_node) {
237 std::cout <<
"ecm : contrast : threshold " << this->
m_ecm.
getThreshold() <<
" (default)" << std::endl;
238 std::cout <<
"ecm : contrast : mu1 " << this->
m_ecm.
getMu1() <<
" (default)" << std::endl;
239 std::cout <<
"ecm : contrast : mu2 " << this->
m_ecm.
getMu2() <<
" (default)" << std::endl;
243 std::cout <<
"ecm : sample : sample_step : " << this->
m_ecm.
getSampleStep() <<
" (default)" << std::endl;
257 bool step_node =
false;
262 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
263 if (dataNode->type == XML_ELEMENT_NODE) {
264 std::map<std::string, int>::iterator iter_data = this->
nodeMap.find((
char *)dataNode->name);
265 if (iter_data !=
nodeMap.end()) {
266 switch (iter_data->second) {
284 std::cout <<
"ecm : sample : sample_step : " << this->
m_ecm.
getSampleStep() <<
" (default)" << std::endl;
286 std::cout <<
"ecm : sample : sample_step : " << this->
m_ecm.
getSampleStep() << std::endl;
299 bool step_node =
false;
306 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
307 if (dataNode->type == XML_ELEMENT_NODE) {
308 std::map<std::string, int>::iterator iter_data = this->
nodeMap.find((
char *)dataNode->name);
309 if (iter_data !=
nodeMap.end()) {
310 switch (iter_data->second) {
332 std::cout <<
"[DEPRECATED] sample : sample_step : " << this->
m_ecm.
getSampleStep() <<
" (default)" << std::endl;
334 std::cout <<
"[DEPRECATED] sample : sample_step : " << this->
m_ecm.
getSampleStep() << std::endl;
343 std::cout <<
" WARNING : This node (sample) is deprecated." << std::endl;
344 std::cout <<
" It should be moved in the ecm node (ecm : sample)." << std::endl;
357 bool size_node =
false;
358 bool nb_mask_node =
false;
364 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
365 if (dataNode->type == XML_ELEMENT_NODE) {
366 std::map<std::string, int>::iterator iter_data = this->
nodeMap.find((
char *)dataNode->name);
367 if (iter_data !=
nodeMap.end()) {
368 switch (iter_data->second) {
390 "parameter should be different " 391 "from zero in xml file"));
395 std::cout <<
"ecm : mask : size : " << this->
m_ecm.
getMaskSize() <<
" (default)" << std::endl;
397 std::cout <<
"ecm : mask : size : " << this->
m_ecm.
getMaskSize() << std::endl;
400 std::cout <<
"ecm : mask : nb_mask : " << this->
m_ecm.
getMaskNumber() <<
" (default)" << std::endl;
415 bool tracking_node =
false;
420 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
421 if (dataNode->type == XML_ELEMENT_NODE) {
422 std::map<std::string, int>::iterator iter_data = this->
nodeMap.find((
char *)dataNode->name);
423 if (iter_data !=
nodeMap.end()) {
424 switch (iter_data->second) {
427 tracking_node =
true;
441 std::cout <<
"ecm : range : tracking : " << this->
m_ecm.
getRange() <<
" (default)" << std::endl;
443 std::cout <<
"ecm : range : tracking : " << this->
m_ecm.
getRange() << std::endl;
456 bool edge_threshold_node =
false;
457 bool mu1_node =
false;
458 bool mu2_node =
false;
465 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
466 if (dataNode->type == XML_ELEMENT_NODE) {
467 std::map<std::string, int>::iterator iter_data = this->
nodeMap.find((
char *)dataNode->name);
468 if (iter_data !=
nodeMap.end()) {
469 switch (iter_data->second) {
472 edge_threshold_node =
true;
495 if (!edge_threshold_node)
496 std::cout <<
"ecm : contrast : threshold " << this->
m_ecm.
getThreshold() <<
" (default)" << std::endl;
498 std::cout <<
"ecm : contrast : threshold " << this->
m_ecm.
getThreshold() << std::endl;
501 std::cout <<
"ecm : contrast : mu1 " << this->
m_ecm.
getMu1() <<
" (default)" << std::endl;
503 std::cout <<
"ecm : contrast : mu1 " << this->
m_ecm.
getMu1() << std::endl;
506 std::cout <<
"ecm : contrast : mu2 " << this->
m_ecm.
getMu2() <<
" (default)" << std::endl;
508 std::cout <<
"ecm : contrast : mu2 " << this->
m_ecm.
getMu2() << std::endl;
511 #elif !defined(VISP_BUILD_SHARED_LIBS) 514 void dummy_vpMbtXmlParser(){};
virtual ~vpMbtXmlParser()
void writeMainClass(xmlNodePtr node)
void read_contrast(xmlDocPtr doc, xmlNodePtr node)
vpCameraParameters cam
Camera parameters.
virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node)
void read_lod(xmlDocPtr doc, xmlNodePtr node)
void read_range(xmlDocPtr doc, xmlNodePtr node)
void setMaskNumber(const unsigned int &a)
void setSampleStep(const double &s)
double angleAppear
Angle to determine if a face appeared.
error that can be emited by ViSP classes.
double minLineLengthThreshold
Minimum line length to track a segment when LOD is enabled.
double xmlReadDoubleChild(xmlDocPtr doc, xmlNodePtr node)
unsigned int getMaskSize() const
double angleDisappear
Angle to determine if a face disappeared.
void setMu1(const double &mu_1)
void read_sample_deprecated(xmlDocPtr doc, xmlNodePtr node)
void read_camera(xmlDocPtr doc, xmlNodePtr node)
double getThreshold() const
vpMe m_ecm
Moving edges parameters.
void setMaskSize(const unsigned int &a)
double getSampleStep() const
int xmlReadIntChild(xmlDocPtr doc, xmlNodePtr node)
void read_face(xmlDocPtr doc, xmlNodePtr node)
unsigned int getMaskNumber() const
void parse(const char *filename)
void read_sample(xmlDocPtr doc, xmlNodePtr node)
unsigned int xmlReadUnsignedIntChild(xmlDocPtr doc, xmlNodePtr node)
void setMu2(const double &mu_2)
void read_mask(xmlDocPtr doc, xmlNodePtr node)
void setThreshold(const double &t)
void read_ecm(xmlDocPtr doc, xmlNodePtr node)
void setRange(const unsigned int &r)
std::map< std::string, int > nodeMap
unsigned int getRange() const
double minPolygonAreaThreshold
Minimum polygon area to track a face when LOD is enabled.
bool useLod
If true, the LOD is enabled, otherwise it is not.
void parse(const std::string &filename)