void queryLineFrame(vector<Frame> &frames, LBDDatabase &db, int resultSize = 5) {
    string filename = "queryLineResult.yml";
    cv::FileStorage resultFS(filename.c_str(), cv::FileStorage::WRITE);
    if(!resultFS.isOpened()) throw string("Could not open file ") + filename;
    resultFS << "result" << "["; //result
    for(size_t i = 0; i < frames.size(); ++i) {
        resultFS<<"{";
        resultFS << "queryImage" << "{";
        resultFS << "frameID" << frames[i].getID();
        resultFS << "frameName" << frames[i].getImageName();
        resultFS << "framePose" << frames[i].getFramePose();
        resultFS << "}"; //query image
        QueryResults results;
        db.query(frames[i].getLineFeatureDescs(), results, resultSize);
        scaleSortedResult(results, results.back().Score, results.front().Score);
        resultFS << "queryResults" << "[";
        for(size_t j = 0; j < results.size(); ++j) {
            int id = (int)results[j].Id;
            double score = (double)results[j].Score;
            vector<double> resultPose;
            assert(db.getPose(id, resultPose));
            resultFS << "{";
            resultFS << "frameID" << id;
            resultFS << "score" << score;
            resultFS << "pose" << resultPose;
            resultFS << "}";
        }
        resultFS << "]";
        resultFS << "}";
    }
    resultFS << "]"; //result
    resultFS.release();
}
Esempio n. 2
0
acl::GroupID GetNewGroupID()
{
  boost::lock_guard<boost::mutex> lock(getNewGroupIdMtx);
  
  QueryResults results;
  boost::unique_future<bool> future;
  mongo::Query query;
  query.sort("gid", 0);
  TaskPtr task(new db::Select("groups", query, results, future, 1));
  Pool::Queue(task);

  future.wait();

  if (results.size() == 0) return acl::GroupID(1);

  int gid = results.back().getIntField("gid");
  return acl::GroupID(++gid);
}