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


C++ ImageFeature::size方法代码示例

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


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

示例1: toVector

vector<double> toVector(const ImageFeature &image) {
  vector<double> result(image.size());
  for(uint i=0;i<image.size();++i) {
    result[i]=image[i];
  }
  return result;
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:7,代码来源:imagelib.cpp

示例2: histogramNormalization

void histogramNormalization(ImageFeature &img) {
  const uint bins=256;
  vector<int> H(bins);
  vector<double> T(bins);

  for(uint c=0;c<img.zsize();++c) {
    //DBG(10) << "c=" << c << endl;
    
    for(uint x=0;x<img.xsize();++x) {
      for(uint y=0;y<img.ysize();++y) {
        ++H[int(img(x,y,c)*255)];
      }
    }
    
    for(uint p=1;p<bins;++p) {
      H[p]+=H[p-1];
    }
    
    for(uint p=0;p<bins;++p) {
      T[p]=(1.0/double(img.size()))*double(H[p]);
    }
    
    for(uint x=0;x<img.xsize();++x) {
      for(uint y=0;y<img.ysize();++y) {
        img(x,y,c)=T[int(img(x,y,c)*255)];
      }
    }
    
  }
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:30,代码来源:imagelib.cpp

示例3: main

int main(int argc , char **argv) {
  
  GetPot cl(argc,argv);
  
  if(cl.search("-h")) {USAGE(); exit(0);}

  string  line;
  if(cl.search("-E")) {
    cout << "Estimating PCA" << endl;
    
    ifstream filelist(cl.follow("filelist","-E"));
    ImageFeature img;    
    getline(filelist,line);

    img.load(line,true);
    cout << line << endl;
    
    PCA pca(img.size());
    cout << img.size() << endl;
    
    pca.putData(img.layerVector(0));
    
    while(getline(filelist,line)) {
      cout << line << endl;
      img.load(line,true);
      pca.putData(img.layerVector(0));
    }
    pca.dataEnd();
    pca.save(cl.follow("covariance.pca","-c"));
    pca.calcPCA();
    pca.save(cl.follow("transformation.pca","-t"));
    filelist.close();
    
  } else if(cl.search("-T")) {
    PCA pca;
    pca.load(cl.follow("transformation.pca","-t"));
    int dim=cl.follow(20,"-d");
    
    ifstream filelist(cl.follow("filelist","-T"));
    vector<double> tmp;
    ImageFeature img;
    while(getline(filelist,line)) {
      cout << line << endl;
      img.load(line,true);
      tmp=pca.transform(img.layerVector(0),img.size());
      tmp.resize(dim);
      VectorFeature tmpvec(tmp);
      tmpvec.save(line+".pca.vec.gz");
    }
    filelist.close();
  } else if(cl.search("-B")) {
    PCA pca;
    pca.load(cl.follow("transformation.pca","-t"));
    int x=cl.follow(16,"-x");
    int y=cl.follow(16,"-y");
    ifstream filelist(cl.follow("filelist","-B"));
    vector<double> tmp;
    VectorFeature tmpvec;
    while(getline(filelist,line)) {
      cout << line << endl;
      tmpvec.load(line);
      vector<double> tmp;
      tmp=pca.backTransform(tmpvec.data());
      ImageFeature img(tmp,x,y);
      cutoff(img);
      img.save(line+".backpca.png");
    }
    filelist.close();
  } else if(cl.search("-M")) {
    ImageFeature img; img.load(cl.follow("image.png","-M"),true);
    PCA pca;
    vector<double> backproj,vec;
    pca.load(cl.follow("transformation.pca","-t"));
    int w=cl.follow(16,"-x");
    int h=cl.follow(16,"-y");
    double scalefac=cl.follow(0.8333,"-s");
    int dim=cl.follow(20,"-d");
    
    ImageFeature scimg(img);
    ImageFeature patch;
    uint minX=100000, minY=100000; 
    uint maxX=100000, maxY=100000; 
   
    while(int(scimg.xsize())>=w and int(scimg.ysize())>=h) {
      DBG(10) << VAR(scimg.xsize()) << " x " << VAR(scimg.ysize()) << endl;
      ImageFeature faceprobmap(scimg.xsize(),scimg.ysize(),1);
      double maxDist=0.0;
      double minDist=numeric_limits<double>::max();
      
      vector<double> tmpvec;

      for(uint x=0;x<scimg.xsize();++x) {
        DBG(10) << VAR(x) << endl;
        for(uint y=0;y<scimg.ysize();++y) {
          patch=getPatch(scimg,x,y,x+w,y+h);
          vec=patch.layerVector(0);
          
          vector<double> imgMinMean=vec;
          for(uint i=0;i<imgMinMean.size();++i) {
            imgMinMean[i]-=pca.mean()[i];
//.........这里部分代码省略.........
开发者ID:418231020,项目名称:fire-cbir,代码行数:101,代码来源:eigenfacer.cpp


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