Ejemplo n.º 1
0
/*!
  Read the main class. This method corresponds to the parsing of the main 
  document (which contains the whole data in the class). At this point, the 
  document exists and is open. 
  
  \param doc : Pointer to the document to parse. 
  \param node : Pointer to the root node of the document. 
*/
void
vpExampleDataParser::readMainClass (xmlDocPtr doc, xmlNodePtr node)
{
  for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL;  dataNode = dataNode->next)  {
    if(dataNode->type == XML_ELEMENT_NODE){
      std::map<std::string, int>::iterator iter_data= this->nodeMap.find((char*)dataNode->name);
      if(iter_data != nodeMap.end()){
        switch (iter_data->second){
        case range:
          this->m_range = xmlReadDoubleChild(doc, dataNode);
          break;
        case step:
          this->m_step = xmlReadIntChild(doc, dataNode);
          break;
        case size_filter:
          this->m_size_filter = xmlReadIntChild(doc, dataNode);
          break;
        case name:{
          this->m_name = xmlReadStringChild(doc, dataNode);
        }break;
        default:
          vpTRACE("unknown tag in readConfigNode : %d, %s", iter_data->second, (iter_data->first).c_str());
          break;
        }
      }
    }
  }
}
Ejemplo n.º 2
0
void
vpMbXmlParser::read_lod (xmlDocPtr doc, xmlNodePtr node) {
  bool use_lod_node = false;
  bool min_line_length_threshold_node = false;
  bool min_polygon_area_threshold_node = false;


  for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL;  dataNode = dataNode->next)  {
    if(dataNode->type == XML_ELEMENT_NODE){
      std::map<std::string, int>::iterator iter_data= this->nodeMap.find((char*)dataNode->name);
      if(iter_data != nodeMap.end()){
        switch (iter_data->second){
        case use_lod:
          useLod = (xmlReadIntChild(doc, dataNode) != 0);
          use_lod_node = true;
          break;
        case min_line_length_threshold:
          minLineLengthThreshold = xmlReadDoubleChild(doc, dataNode);
          min_line_length_threshold_node = true;
          break;
        case min_polygon_area_threshold:
          minPolygonAreaThreshold = xmlReadDoubleChild(doc, dataNode);
          min_polygon_area_threshold_node = true;
          break;
        default:{
//          vpTRACE("unknown tag in read_contrast : %d, %s", iter_data->second, (iter_data->first).c_str());
          }break;
        }
      }
    }
  }

  if(!use_lod_node)
    std::cout << "lod : use lod : " << useLod << " (default)" <<std::endl;
  else
    std::cout << "lod : use lod : " << useLod << std::endl;

  if(!min_line_length_threshold_node)
    std::cout <<"lod : min line length threshold : " << minLineLengthThreshold <<" (default)" <<std::endl;
  else
    std::cout <<"lod : min line length threshold : " << minLineLengthThreshold <<std::endl;

  if(!min_polygon_area_threshold_node)
    std::cout <<"lod : min polygon area threshold : " << minPolygonAreaThreshold <<" (default)" <<std::endl;
  else
    std::cout <<"lod : min polygon area threshold : " << minPolygonAreaThreshold <<std::endl;
}
Ejemplo n.º 3
0
/*!
  Read klt information.
  
  \throw vpException::fatalError if there was an unexpected number of data. 
  
  \param doc : Pointer to the document.
  \param node : Pointer to the node of the camera information.
*/
void 
vpMbtKltXmlParser::read_klt(xmlDocPtr doc, xmlNodePtr node)
{
  bool mask_border_node = false;
  bool max_features_node = false;
  bool window_size_node = false;
  bool quality_node = false;
  bool min_distance_node = false;
  bool harris_node = false;
  bool size_block_node = false;
  bool pyramid_lvl_node = false;
  
  for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL;  dataNode = dataNode->next)  {
    if(dataNode->type == XML_ELEMENT_NODE){
      std::map<std::string, int>::iterator iter_data= this->nodeMap.find((char*)dataNode->name);
      if(iter_data != nodeMap.end()){
        switch (iter_data->second){
        case mask_border:{
          maskBorder = xmlReadUnsignedIntChild(doc, dataNode);
          mask_border_node = true;
          }break;
        case max_features:{
          maxFeatures = xmlReadUnsignedIntChild(doc, dataNode);
          max_features_node = true;
          }break;
        case window_size:{
          winSize = xmlReadUnsignedIntChild(doc, dataNode);
          window_size_node = true;
          }break;
        case quality:{
          qualityValue = xmlReadDoubleChild(doc, dataNode);
          quality_node = true;
          }break;
        case min_distance:{
          minDist = xmlReadDoubleChild(doc, dataNode);
          min_distance_node = true;
          }break;
        case harris:{
          harrisParam = xmlReadDoubleChild(doc, dataNode);
          harris_node = true;
          }break;
        case size_block:{
          blockSize = xmlReadUnsignedIntChild(doc, dataNode);
          size_block_node = true;
          }break;
        case pyramid_lvl:{
          pyramidLevels = xmlReadUnsignedIntChild(doc, dataNode);
          pyramid_lvl_node = true;
          }break; 
        default:{
//          vpTRACE("unknown tag in read_camera : %d, %s", iter_data->second, (iter_data->first).c_str());
          }break;
        }
      }
    }
  }
  
  if(!mask_border_node)
    std::cout << "klt : Mask Border : "<< maskBorder <<" (default)" <<std::endl;
  else
    std::cout << "klt : Mask Border : "<< maskBorder <<std::endl;
  
  if(!max_features_node)
    std::cout << "klt : Max Features : "<< maxFeatures <<" (default)" <<std::endl;
  else
    std::cout << "klt : Max Features : "<< maxFeatures <<std::endl;
  
  if(!window_size_node)
    std::cout << "klt : Windows Size : "<< winSize <<" (default)" <<std::endl;
  else
    std::cout << "klt : Windows Size : "<< winSize <<std::endl;
  
  if(!quality_node)
    std::cout << "klt : Quality : "<< qualityValue <<" (default)" <<std::endl;
  else
    std::cout << "klt : Quality : "<< qualityValue <<std::endl;
  
  if(!min_distance_node)
    std::cout << "klt : Min Distance : "<< minDist <<" (default)" <<std::endl;
  else
    std::cout << "klt : Min Distance : "<< minDist <<std::endl;
  
  if(!harris_node)
    std::cout << "klt : Harris Parameter : "<< harrisParam <<" (default)" <<std::endl;
  else
    std::cout << "klt : Harris Parameter : "<< harrisParam <<std::endl;
  
  if(!size_block_node)
    std::cout << "klt : Block Size : "<< blockSize <<" (default)" <<std::endl;
  else
    std::cout << "klt : Block Size : "<< blockSize <<std::endl;
  
  if(!pyramid_lvl_node)
    std::cout << "klt : Pyramid Levels : "<< pyramidLevels <<" (default)" <<std::endl;
  else
    std::cout << "klt : Pyramid Levels : "<< pyramidLevels <<std::endl;
}
Ejemplo n.º 4
0
/*!
  Read face information.
  
  \throw vpException::fatalError if there was an unexpected number of data. 
  
  \param doc : Pointer to the document.
  \param node : Pointer to the node of the camera information.
*/
void 
vpMbXmlParser::read_face(xmlDocPtr doc, xmlNodePtr node)
{
  bool angle_appear_node = false;
  bool angle_disappear_node = false;
  bool near_clipping_node = false;
  bool far_clipping_node = false;
  bool fov_clipping_node = false;
  
  for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL;  dataNode = dataNode->next)  {
    if(dataNode->type == XML_ELEMENT_NODE){
      std::map<std::string, int>::iterator iter_data= this->nodeMap.find((char*)dataNode->name);
      if(iter_data != nodeMap.end()){
        switch (iter_data->second){
        case angle_appear:{
          angleAppear = xmlReadDoubleChild(doc, dataNode);
          angle_appear_node = true;
          }break;
        case angle_disappear:{
          angleDisappear = xmlReadDoubleChild(doc, dataNode);
          angle_disappear_node = true;
          }break;
        case near_clipping:{
          nearClipping = xmlReadDoubleChild(doc, dataNode);
          near_clipping_node = true;
          hasNearClipping = true;
          }break;
        case far_clipping:{
          farClipping = xmlReadDoubleChild(doc, dataNode);
          far_clipping_node = true;
          hasFarClipping = true;
          }break;
        case fov_clipping:{
          if (xmlReadIntChild(doc, dataNode))
            fovClipping = true;
          else
            fovClipping = false;
          fov_clipping_node = true;
          }break;
        default:{
//          vpTRACE("unknown tag in read_camera : %d, %s", iter_data->second, (iter_data->first).c_str());
          }break;
        }
      }
    }
  }
  
  if(!angle_appear_node)
    std::cout << "face : Angle Appear : "<< angleAppear << " (default)" <<std::endl;
  else
    std::cout << "face : Angle Appear : "<< angleAppear <<std::endl;
  
  if(!angle_disappear_node)
    std::cout << "face : Angle Disappear : "<< angleDisappear << " (default)" <<std::endl;
  else
    std::cout << "face : Angle Disappear : "<< angleDisappear <<std::endl;
  
  if(near_clipping_node)
    std::cout << "face : Near Clipping : "<< nearClipping <<std::endl;
  
  if(far_clipping_node)
    std::cout << "face : Far Clipping : "<< farClipping <<std::endl;
  
  if(fov_clipping_node) {
    if(fovClipping)
      std::cout << "face : Fov Clipping : True" <<std::endl;
    else
      std::cout << "face : Fov Clipping : False" <<std::endl;
  }
}
Ejemplo n.º 5
0
/*!
  Read camera information.
  
  \throw vpException::fatalError if there was an unexpected number of data. 
  
  \param doc : Pointer to the document.
  \param node : Pointer to the node of the camera information.
*/
void 
vpMbXmlParser::read_camera (xmlDocPtr doc, xmlNodePtr node)
{
  bool u0_node = false;
  bool v0_node = false;
  bool px_node = false;
  bool py_node = false;
  
    // current data values.
	double d_u0 = this->cam.get_u0();
	double d_v0 = this->cam.get_v0();
	double d_px = this->cam.get_px();
	double d_py = this->cam.get_py();
	
  for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL;  dataNode = dataNode->next)  {
    if(dataNode->type == XML_ELEMENT_NODE){
      std::map<std::string, int>::iterator iter_data= this->nodeMap.find((char*)dataNode->name);
      if(iter_data != nodeMap.end()){
        switch (iter_data->second){
        case u0:{
          d_u0 = xmlReadDoubleChild(doc, dataNode);
          u0_node = true;
          }break;
        case v0:{
          d_v0 = xmlReadDoubleChild(doc, dataNode);
          v0_node = true;
          }break;
        case px:{
          d_px = xmlReadDoubleChild(doc, dataNode);
          px_node = true;
          }break;
        case py:{
          d_py = xmlReadDoubleChild(doc, dataNode);
          py_node = true;
          }break;
        default:{
//          vpTRACE("unknown tag in read_camera : %d, %s", iter_data->second, (iter_data->first).c_str());
          }break;
        }
      }
    }
  }
  
  this->cam.initPersProjWithoutDistortion(d_px, d_py, d_u0, d_v0) ;
  
  if(!u0_node)
    std::cout << "camera : u0 : "<< this->cam.get_u0() << " (default)" <<std::endl;
  else
    std::cout << "camera : u0 : "<< this->cam.get_u0() <<std::endl;
  
  if(!v0_node)
    std::cout << "camera : v0 : "<< this->cam.get_v0() << " (default)" <<std::endl;
  else
    std::cout << "camera : v0 : "<< this->cam.get_v0() <<std::endl;
  
  if(!px_node)
    std::cout << "camera : px : "<< this->cam.get_px() << " (default)" <<std::endl;
  else
    std::cout << "camera : px : "<< this->cam.get_px() <<std::endl;

  if(!py_node)
    std::cout << "camera : py : "<< this->cam.get_py() << " (default)" <<std::endl;
  else
    std::cout << "camera : py : "<< this->cam.get_py() <<std::endl;
}