ObjectEntry.cpp
Go to the documentation of this file.
00001 #include <blort/ObjectEntry.h>
00002 
00003 blort::RecogData blort::getBest(const ObjectEntry& obj)
00004 {
00005   float best_conf = 0;
00006   size_t best_i = 0;
00007   for(size_t i = 0; i < obj.recog_data.size(); ++i)
00008   {
00009     if(obj.recog_data[i].conf > best_conf)
00010     {
00011       best_conf = obj.recog_data[i].conf;
00012       best_i = i;
00013     }
00014   }
00015   return obj.recog_data[best_i];
00016 }
00017 
00018 void blort::buildFromFiles(const std::vector<std::string> & ply_models, const std::vector<std::string> & sift_files, const std::vector<std::string> & model_names, std::vector<blort::ObjectEntry> & out)
00019 {
00020   std::vector<size_t> sift_index(0);
00021   return buildFromFiles(ply_models, sift_files, model_names, out, sift_index);
00022 }
00023 
00024 void blort::buildFromFiles(const std::vector<std::string> & ply_models, const std::vector<std::string> & sift_files, const std::vector<std::string> & model_names, std::vector<blort::ObjectEntry> & out, std::vector<size_t> & sift_index)
00025 {
00026   out.resize(0);
00027   sift_index.resize(0);
00028   for(size_t i = 0; i < model_names.size(); ++i)
00029   {
00030     blort::ObjectEntry entry;
00031     entry.name = model_names[i];
00032     for(size_t j = 0; j < ply_models.size(); ++j)
00033     {
00034       if(ply_models[j].find(entry.name) != std::string::npos)
00035       {
00036         entry.ply_model = ply_models[j];
00037         break;
00038       }
00039     }
00040     for(size_t j = 0; j < sift_files.size(); ++j)
00041     {
00042       if(sift_files[j].find(entry.name) != std::string::npos)
00043       {
00044         //entry.recog_data.push_back(sift_files[j]);
00045         const std::string s = sift_files[j];
00046         entry.recog_data.push_back(s.substr(s.find_last_of("\\/")+1));
00047       }
00048     }
00049     out.push_back(entry);
00050   }
00051 }


blort
Author(s): Thomas Mörwald , Michael Zillich , Andreas Richtsfeld , Johann Prankl , Markus Vincze , Bence Magyar
autogenerated on Wed Aug 26 2015 15:24:12