当前位置: 首页>>代码示例>>C++>>正文


C++ ImageSet::load方法代码示例

本文整理汇总了C++中ImageSet::load方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageSet::load方法的具体用法?C++ ImageSet::load怎么用?C++ ImageSet::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageSet的用法示例。


在下文中一共展示了ImageSet::load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadImageSet

ImageSet* loadImageSet(FeatureDatabase& fdb, LshKBM& lshKBM,
    vector<uint32_t>& imageIds, string pathToSet)
{//load/create inverted file
  ImageSet* imgSet;
  FILE *fTest=fopen(pathToSet.c_str(),"rb");
  if(!fTest){
    cout<<"Registering images - creation of inverted file"<<endl;
    imgSet=new ImageSet();
    imgSet->registerImages(lshKBM,fdb,imageIds);
    cout<<"Saving image set to "<<pathToSet<<endl;
    FILE *f=fopen(pathToSet.c_str(), "wb");
    if(!f)
      cerr<<"Cannot write image set file"<<endl;
    else {
      imgSet->save(f,lshKBM);
      fclose(f);
    }
  }else{
    cout<<"Loading image set from "<<pathToSet<<endl;
    imgSet = new ImageSet();
    bool ok = imgSet->load(fTest, lshKBM, lshKBM.getVersion()<2); // in version 0 and 1 the guid was not handled correctly ...
    fclose(fTest);
    if(!ok) return NULL;

    // Sanity check: query_db_index is where we will lookup detailed infos like
    // the file name later, when printing out matching images. This database
    // must be the same as the one used for image registration.
    // However, if the image set has been created using a subset of a
    // database (using -i0 -i4 -i6 ...), img_set->num_images will be less
    // than the number of images in the db. Without a database ID that's
    // stored in the image set, we cannot realiably check that condition.
    if(fdb.index().size() != imgSet->imageCount()) {
      cout<<"WARNING: Database is (probably) not the one used for the image set, you might need --query-db\n"
          "         Don't worry about this message if you registered a subset of a database (specifying images via -i)"<<endl;
    }
//    for(unsigned int node = 0; node < imgSet->wordCount(); node++) {
//      cout<<"@"<<node<<": ";
//      uint32_t imgCount=0;
//      DB_TFIDF* tfidf = imgSet->getWordInfos()[node].firstDB_TFIDF;
//      while(tfidf) {
//        for(int i=0; i<DB_TFIDF_SIZE; i++) {
//          if(tfidf->imgID[i] == -1)
//            break;
//          //            cout<<tfidf->imgID[i]<<"; ";
//        }
//        tfidf = tfidf->nextDB_TFIDF;
//        ++imgCount;
//      }
//      cout<<" #="<<imgCount<<"\t";
//    }
//    cout<<endl;
  }
  return imgSet;
}
开发者ID:jstraub,项目名称:ptamRosBinaryFeatureRelocalization,代码行数:54,代码来源:briefIR.cpp


注:本文中的ImageSet::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。