44 #include <visp/vpConfig.h>
52 #include <libxml/xmlmemory.h>
54 #include <visp/vpMbtXmlParser.h>
109 std::string file = filename;
134 bool camera_node =
false;
135 bool face_node =
false;
136 bool ecm_node =
false;
137 bool sample_node =
false;
138 bool lod_node =
false;
140 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
141 if(dataNode->type == XML_ELEMENT_NODE){
142 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
143 if(iter_data !=
nodeMap.end()){
144 switch (iter_data->second){
174 std::cout <<
"camera : u0 : "<< this->
cam.
get_u0() <<
" (default)" <<std::endl;
175 std::cout <<
"camera : v0 : "<< this->
cam.
get_v0() <<
" (default)" <<std::endl;
176 std::cout <<
"camera : px : "<< this->
cam.
get_px() <<
" (default)" <<std::endl;
177 std::cout <<
"camera : py : "<< this->
cam.
get_py() <<
" (default)" <<std::endl;
181 std::cout <<
"face : Angle Appear : "<<
angleAppear <<
" (default)" <<std::endl;
182 std::cout <<
"face : Angle Disappear : "<<
angleDisappear <<
" (default)" <<std::endl;
186 std::cout <<
"ecm : mask : size : "<< this->
m_ecm.
getMaskSize() <<
" (default)" <<std::endl;
187 std::cout <<
"ecm : mask : nb_mask : "<< this->
m_ecm.
getMaskNumber() <<
" (default)" <<std::endl;
188 std::cout <<
"ecm : range : tracking : "<< this->
m_ecm.
getRange()<<
" (default)" <<std::endl;
189 std::cout <<
"ecm : contrast : threshold : " << this->
m_ecm.
getThreshold()<<
" (default)" <<std::endl;
190 std::cout <<
"ecm : contrast : mu1 : " << this->
m_ecm.
getMu1()<<
" (default)" <<std::endl;
191 std::cout <<
"ecm : contrast : mu2 : " << this->
m_ecm.
getMu2()<<
" (default)" <<std::endl;
195 std::cout <<
"sample : sample_step : "<< this->
m_ecm.
getSampleStep()<<
" (default)" << std::endl;
200 std::cout <<
"lod : use lod : " <<
useLod <<
" (default)" << std::endl;
218 bool mask_node =
false;
219 bool range_node =
false;
220 bool contrast_node =
false;
222 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
223 if(dataNode->type == XML_ELEMENT_NODE){
224 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
225 if(iter_data !=
nodeMap.end()){
226 switch (iter_data->second){
237 contrast_node =
true;
248 std::cout <<
"ecm : mask : size : "<< this->
m_ecm.
getMaskSize() <<
" (default)" <<std::endl;
249 std::cout <<
"ecm : mask : nb_mask : "<< this->
m_ecm.
getMaskNumber() <<
" (default)" <<std::endl;
253 std::cout <<
"ecm : range : tracking : "<< this->
m_ecm.
getRange()<<
" (default)" <<std::endl;
257 std::cout <<
"ecm : contrast : threshold " << this->
m_ecm.
getThreshold()<<
" (default)" <<std::endl;
258 std::cout <<
"ecm : contrast : mu1 " << this->
m_ecm.
getMu1()<<
" (default)" <<std::endl;
259 std::cout <<
"ecm : contrast : mu2 " << this->
m_ecm.
getMu2()<<
" (default)" <<std::endl;
274 bool step_node =
false;
275 bool nb_sample_node =
false;
281 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
282 if(dataNode->type == XML_ELEMENT_NODE){
283 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
284 if(iter_data !=
nodeMap.end()){
285 switch (iter_data->second){
292 nb_sample_node =
true;
306 std::cout <<
"sample : sample_step : "<< this->
m_ecm.
getSampleStep()<<
" (default)" << std::endl;
327 bool size_node =
false;
328 bool nb_mask_node =
false;
334 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
335 if(dataNode->type == XML_ELEMENT_NODE){
336 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
337 if(iter_data !=
nodeMap.end()){
338 switch (iter_data->second){
362 std::cout <<
"ecm : mask : size : "<< this->
m_ecm.
getMaskSize() <<
" (default)" <<std::endl;
364 std::cout <<
"ecm : mask : size : "<< this->
m_ecm.
getMaskSize() <<std::endl;
367 std::cout <<
"ecm : mask : nb_mask : "<< this->
m_ecm.
getMaskNumber() <<
" (default)" <<std::endl;
383 bool tracking_node =
false;
388 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
389 if(dataNode->type == XML_ELEMENT_NODE){
390 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
391 if(iter_data !=
nodeMap.end()){
392 switch (iter_data->second){
395 tracking_node =
true;
408 std::cout <<
"ecm : range : tracking : "<< this->
m_ecm.
getRange()<<
" (default)" <<std::endl;
410 std::cout <<
"ecm : range : tracking : "<< this->
m_ecm.
getRange()<<std::endl;
425 bool edge_threshold_node =
false;
426 bool mu1_node =
false;
427 bool mu2_node =
false;
434 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
435 if(dataNode->type == XML_ELEMENT_NODE){
436 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
437 if(iter_data !=
nodeMap.end()){
438 switch (iter_data->second){
441 edge_threshold_node =
true;
463 if(!edge_threshold_node)
464 std::cout <<
"ecm : contrast : threshold " << this->
m_ecm.
getThreshold()<<
" (default)" <<std::endl;
466 std::cout <<
"ecm : contrast : threshold " << this->
m_ecm.
getThreshold()<<std::endl;
469 std::cout <<
"ecm : contrast : mu1 " << this->
m_ecm.
getMu1()<<
" (default)" <<std::endl;
471 std::cout <<
"ecm : contrast : mu1 " << this->
m_ecm.
getMu1()<<std::endl;
474 std::cout <<
"ecm : contrast : mu2 " << this->
m_ecm.
getMu2()<<
" (default)" <<std::endl;
476 std::cout <<
"ecm : contrast : mu2 " << this->
m_ecm.
getMu2()<<std::endl;
481 bool use_lod_node =
false;
482 bool min_line_length_threshold_node =
false;
483 bool min_polygon_area_threshold_node =
false;
486 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
487 if(dataNode->type == XML_ELEMENT_NODE){
488 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
489 if(iter_data !=
nodeMap.end()){
490 switch (iter_data->second){
497 min_line_length_threshold_node =
true;
501 min_polygon_area_threshold_node =
true;
512 std::cout <<
"lod : use lod : " <<
useLod <<
" (default)" <<std::endl;
514 std::cout <<
"lod : use lod : " <<
useLod << std::endl;
516 if(!min_line_length_threshold_node)
521 if(!min_polygon_area_threshold_node)
virtual ~vpMbtXmlParser()
void writeMainClass(xmlNodePtr node)
unsigned int getRange() const
unsigned int getMaskSize() const
void read_contrast(xmlDocPtr doc, xmlNodePtr node)
vpCameraParameters cam
Camera parameters.
virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node)
unsigned int getMaskNumber() const
void read_range(xmlDocPtr doc, xmlNodePtr node)
void setMaskNumber(const unsigned int &a)
double minLineLengthThreshold
Minimum line length to track a segment when LOD is enabled.
void setSampleStep(const double &s)
void setNbTotalSample(const int &nb)
double angleAppear
Angle to determine if a face appeared.
error that can be emited by ViSP classes.
double xmlReadDoubleChild(xmlDocPtr doc, xmlNodePtr node)
double angleDisappear
Angle to determine if a face disappeared.
void setMu1(const double &mu_1)
int getNbTotalSample() const
bool useLod
If true, the LOD is enabled, otherwise it is not.
double getThreshold() const
void read_camera(xmlDocPtr doc, xmlNodePtr node)
vpMe m_ecm
Moving edges parameters.
void setMaskSize(const unsigned int &a)
int xmlReadIntChild(xmlDocPtr doc, xmlNodePtr node)
void read_face(xmlDocPtr doc, xmlNodePtr node)
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)
double getSampleStep() const
std::map< std::string, int > nodeMap
double minPolygonAreaThreshold
Minimum polygon area to track a face when LOD is enabled.
void read_lod(xmlDocPtr doc, xmlNodePtr node)
void parse(const std::string &filename)