43 #include <visp/vpConfig.h>
51 #include <libxml/xmlmemory.h>
53 #include <visp/vpMbtXmlParser.h>
116 std::string file = filename;
141 bool ecm_node =
false;
142 bool sample_node =
false;
143 bool camera_node =
false;
144 bool face_node =
false;
146 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
147 if(dataNode->type == XML_ELEMENT_NODE){
148 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
149 if(iter_data !=
nodeMap.end()){
150 switch (iter_data->second){
176 std::cout <<
"WARNING: ECM Node not specified, default values used" << std::endl;
179 std::cout <<
"WARNING: SAMPLE Node not specified, default values used" << std::endl;
182 std::cout <<
"WARNING: CAMERA Node not specified, default values used" << std::endl;
185 std::cout <<
"WARNING: FACE Node not specified, default values used" << std::endl;
200 bool mask_node =
false;
201 bool range_node =
false;
202 bool contrast_node =
false;
204 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
205 if(dataNode->type == XML_ELEMENT_NODE){
206 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
207 if(iter_data !=
nodeMap.end()){
208 switch (iter_data->second){
219 contrast_node =
true;
230 std::cout <<
"WARNING: In ECM Node, MASK Node not specified, default values used" << std::endl;
233 std::cout <<
"WARNING: In ECM Node, RANGE Node not specified, default values used" << std::endl;
236 std::cout <<
"WARNING: In ECM Node, CONTRAST Node not specified, default values used" << std::endl;
250 bool step_node =
false;
251 bool nb_sample_node =
false;
257 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
258 if(dataNode->type == XML_ELEMENT_NODE){
259 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
260 if(iter_data !=
nodeMap.end()){
261 switch (iter_data->second){
268 nb_sample_node =
true;
282 std::cout <<
"WARNING: In SAMPLE Node, STEP Node not specified, default value used : " << this->
m_ecm.
getSampleStep() << std::endl;
287 std::cout <<
"WARNING: In SAMPLE Node, NB_SAMPLE Node not specified, default value used : " << this->
m_ecm.
getNbTotalSample() << std::endl;
303 bool height_node =
false;
304 bool width_node =
false;
305 bool u0_node =
false;
306 bool v0_node =
false;
307 bool px_node =
false;
308 bool py_node =
false;
318 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
319 if(dataNode->type == XML_ELEMENT_NODE){
320 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
321 if(iter_data !=
nodeMap.end()){
322 switch (iter_data->second){
358 std::cout <<
"WARNING: In CAMERA Node, HEIGHT Node not specified, default value used" << std::endl;
361 std::cout <<
"WARNING: In CAMERA Node, WIDTH Node not specified, default value used" << std::endl;
364 std::cout <<
"WARNING: In CAMERA Node, u0 Node not specified, default value used : " << this->
cam.
get_u0() << std::endl;
366 std::cout <<
"camera : u0 "<< this->
cam.
get_u0() <<std::endl;
369 std::cout <<
"WARNING: In CAMERA Node, v0 Node not specified, default value used : " << this->
cam.
get_v0() << std::endl;
371 std::cout <<
"camera : v0 "<< this->
cam.
get_v0() <<std::endl;
374 std::cout <<
"WARNING: In CAMERA Node, px Node not specified, default value used : " << this->
cam.
get_px() << std::endl;
376 std::cout <<
"camera : px "<< this->
cam.
get_px() <<std::endl;
379 std::cout <<
"WARNING: In CAMERA Node, py Node not specified, default value used : " << this->
cam.
get_py() << std::endl;
381 std::cout <<
"camera : py "<< this->
cam.
get_py() <<std::endl;
395 bool angle_appear_node =
false;
396 bool angle_disappear_node =
false;
398 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
399 if(dataNode->type == XML_ELEMENT_NODE){
400 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
401 if(iter_data !=
nodeMap.end()){
402 switch (iter_data->second){
405 angle_appear_node =
true;
409 angle_disappear_node =
true;
419 if(!angle_appear_node)
420 std::cout <<
"WARNING: In FACE Node, ANGLE_APPEAR Node not specified, default value used : " <<
angleAppear << std::endl;
422 std::cout <<
"face : Angle Appear "<<
angleAppear <<std::endl;
424 if(!angle_disappear_node)
425 std::cout <<
"WARNING: In FACE Node, ANGLE_DESAPPEAR Node not specified, default value used : " <<
angleDisappear << std::endl;
427 std::cout <<
"face : Angle Disappear : "<<
angleDisappear <<std::endl;
441 bool size_node =
false;
442 bool nb_mask_node =
false;
448 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
449 if(dataNode->type == XML_ELEMENT_NODE){
450 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
451 if(iter_data !=
nodeMap.end()){
452 switch (iter_data->second){
473 std::cout <<
"WARNING: In MASK Node, SIZE Node not specified, default value used : " << this->
m_ecm.
getMaskSize() << std::endl;
478 std::cout <<
"WARNING: In MASK Node, NB_MASK Node not specified, default value used : " << this->
m_ecm.
getMaskNumber() << std::endl;
494 bool tracking_node =
false;
499 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
500 if(dataNode->type == XML_ELEMENT_NODE){
501 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
502 if(iter_data !=
nodeMap.end()){
503 switch (iter_data->second){
506 tracking_node =
true;
519 std::cout <<
"WARNING: In RANGE Node, TRACKING Node not specified, default value used : " << this->
m_ecm.
getRange() << std::endl;
521 std::cout <<
"ecm : range : tracking "<< this->
m_ecm.
getRange()<<std::endl;
536 bool edge_threshold_node =
false;
537 bool mu1_node =
false;
538 bool mu2_node =
false;
545 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
546 if(dataNode->type == XML_ELEMENT_NODE){
547 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
548 if(iter_data !=
nodeMap.end()){
549 switch (iter_data->second){
552 edge_threshold_node =
true;
574 if(!edge_threshold_node)
575 std::cout <<
"WARNING: In CONTRAST Node, EDGE_THRESHOLD Node not specified, default value used : " << this->
m_ecm.
getThreshold() << std::endl;
577 std::cout <<
"ecm : contrast : threshold " << this->
m_ecm.
getThreshold()<<std::endl;
580 std::cout <<
"WARNING: In CONTRAST Node, mu1 Node not specified, default value used : " << this->
m_ecm.
getMu1() << std::endl;
582 std::cout <<
"ecm : contrast : mu1 " << this->
m_ecm.
getMu1()<<std::endl;
585 std::cout <<
"WARNING: In CONTRAST Node, mu2 Node not specified, default value used : " << this->
m_ecm.
getMu2() << std::endl;
587 std::cout <<
"ecm : contrast : mu2 " << this->
m_ecm.
getMu2()<<std::endl;
virtual ~vpMbtXmlParser()
void writeMainClass(xmlNodePtr node)
unsigned int getRange() const
unsigned int getMaskSize() const
void read_contrast(xmlDocPtr doc, xmlNodePtr node)
void readMainClass(xmlDocPtr doc, xmlNodePtr node)
void setMainTag(const std::string &tag)
unsigned int getMaskNumber() const
vpCameraParameters cam
Camera parameters.
void read_range(xmlDocPtr doc, xmlNodePtr node)
void setMaskNumber(const unsigned int &a)
void setSampleStep(const double &s)
void setMu2(const double &mu2)
void setNbTotalSample(const int &nb)
error that can be emited by ViSP classes.
double xmlReadDoubleChild(xmlDocPtr doc, xmlNodePtr node)
void initPersProjWithoutDistortion(const double px, const double py, const double u0, const double v0)
int getNbTotalSample() const
double getThreshold() const
void read_face(xmlDocPtr doc, xmlNodePtr node)
vpMe m_ecm
Moving edges parameters.
void setMaskSize(const unsigned int &a)
double angleAppear
Angle to determine if a face appeared.
int xmlReadIntChild(xmlDocPtr doc, xmlNodePtr node)
double angleDisappear
Angle to determine if a face disappeared.
void parse(const char *filename)
void read_sample(xmlDocPtr doc, xmlNodePtr node)
unsigned int xmlReadUnsignedIntChild(xmlDocPtr doc, xmlNodePtr node)
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)
double getSampleStep() const
std::map< std::string, int > nodeMap
void setMu1(const double &mu1)
void read_camera(xmlDocPtr doc, xmlNodePtr node)
void parse(const std::string &filename)