void TODBaseImporter::importOcclusionObjects(const std::string &modelsPath,
                                             std::vector<EdgeModel> &occlusionObjects, std::vector<PoseRT> &occlusionOffsets) const
{
  //TODO: move up
  const string occlusionPrefix = "occlusion_";
  const string occlusionPostFix = ".xml";
  //TOOD: port to other systems too
  DIR *directory = opendir(testFolder.c_str());
  CV_Assert(directory != 0);

  occlusionObjects.clear();
  for (dirent *entry = readdir(directory); entry != 0; entry = readdir(directory))
  {
    string filename = entry->d_name;
    if (filename.substr(0, occlusionPrefix.length()) != occlusionPrefix)
    {
      continue;
    }

    int objectNameLength = static_cast<int>(filename.length()) - static_cast<int>(occlusionPostFix.length()) - static_cast<int>(occlusionPrefix.length());
    string objectName = filename.substr(occlusionPrefix.length(), objectNameLength);

    EdgeModel edgeModel;
    importEdgeModel(modelsPath, objectName, edgeModel);
    occlusionObjects.push_back(edgeModel);

    PoseRT offset;
    offset.read(testFolder + "/" + filename);
    occlusionOffsets.push_back(offset);
  }
}
Exemplo n.º 2
0
void poseinfo(string path) {
    FileStorage in(path, FileStorage::READ);
    PoseRT pose;
    pose.read(in[PoseRT::YAML_NODE_NAME]);
    in.release();
    cout << boost::format("%10.7f %10.7f %10.7f %10.7f %10.7f %10.7f")
         % pose.tvec.at<double>(0, 0)
         % pose.tvec.at<double>(1, 0)
         % pose.tvec.at<double>(2, 0)
         % pose.rvec.at<double>(0, 0)
         % pose.rvec.at<double>(1, 0)
         % pose.rvec.at<double>(2, 0) << endl;
}
void TODBaseImporter::importOffset(PoseRT &offset) const
{
  //TODO: move up
  const string offsetFilename = "offset.xml";
  offset.read(testFolder + "/" + offsetFilename);
}