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


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

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


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

示例1: fft

ImageFeature fft(const ImageFeature &img) {
  ImageFeature result(img.xsize(),img.ysize(),2);
#ifdef HAVE_FFT_LIBRARY
  fftw_complex FIMG[img.xsize()][img.ysize()];

  for(uint x=0;x<img.xsize();++x) {
    for(uint y=0;y<img.ysize();++y) {
      FIMG[x][y].re=img(x,y,0);
      FIMG[x][y].im=0;
    }
  }
  
  fftwnd_plan plan = fftw2d_create_plan(img.xsize(),img.ysize(), FFTW_FORWARD, FFTW_ESTIMATE  | FFTW_IN_PLACE); 
  fftwnd_one(plan,&FIMG[0][0],NULL);
  fftwnd_destroy_plan(plan);
  
  for(uint x=0;x<img.xsize();++x) {
    for(uint y=0;y<img.ysize();++y) {
      result(x,y,0)=FIMG[x][y].re;
      result(x,y,1)=FIMG[x][y].im;
    }
  }
#else
#warning "FFT is used without FFT library enabled."
  ERR << "FFT not available, thus returning empty image instead of fourier transformed version. All that comes now is probably bogus." << endl;
#endif
  return result;
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:28,代码来源:imagelib.cpp

示例2: convolve

void convolve(ImageFeature &img, const ImageFeature &filter) {
  ImageFeature copy=img;
  
  int height2=filter.ysize()/2;
  int width2=filter.xsize()/2;

  double tmp;
  for(uint c=0;c<img.zsize();++c) {
    for(uint x=0;x<img.xsize();++x) {
      for(uint y=0;y<img.ysize();++y) {
        tmp=0.0;
        for(int i=-width2;i<=width2;++i) {
          int xx=x+i;
          if(xx<int(img.xsize()) && int(xx) >= 0) {
            for(int j=-height2;j<=height2;++j) {
              int yy=y+j; 
              if(int(yy)>=0 && yy < int(img.ysize())) {
                tmp+=filter(i+width2,j+height2,0)*copy(xx,yy,c);
              }
            }
          }
        }
        img(x,y,c)=tmp;
      }
    }
  }
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:27,代码来源:imagelib.cpp

示例3: 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

示例4: makeGray

// default for type is set in imagelib.hpp
// type = 0: maximum (as in HSV)
// type = 1: mean 
// type = 2: luminance (use only for RGB images!)
ImageFeature makeGray(const ImageFeature &img, const uint type) {
  ImageFeature result(img.xsize(), img.ysize(),1) ;
  double value;
  
  if( (type == 2) && (img.zsize() != 3) )
  {
    ERR << "Image has invalid color resolution!" << endl;
    return result;
  }
  
  for(uint x=0;x<img.xsize();++x) {
    for(uint y=0;y<img.ysize();++y) {
      value=0.0;
      switch(type){
      case 0: //max
	for(uint c=0;c<img.zsize();++c) {
	  value=::std::max(value,img(x,y,c));
	}
	break;
      case 1: //mean
        for(uint c=0;c<img.zsize();++c) {
          value+=img(x,y,c);
        }
        value/=img.zsize();
        break;
      case 2: // luminance
        value = 0.3 * img(x,y,0) + 0.59 * img(x,y,1) + 0.11 * img(x,y,2);
        break;
      }
      result(x,y,0)=value;
    }
  }
  return result;
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:38,代码来源:imagelib.cpp

示例5: difference

ImageFeature DifferenceOfGaussian::difference(const ImageFeature& img1, const ImageFeature& img2) {
  ImageFeature newImage = ImageFeature(img1.xsize(), img1.ysize(), 1);
  for (int x = 0; x < (int) newImage.xsize(); x++) {
    for (int y = 0; y < (int) newImage.ysize(); y++) {
      newImage(x, y, 0) = img1(x, y, 0) - img2(x, y, 0);
    }
  }
  return newImage;
}
开发者ID:Ferada,项目名称:fire-cbir,代码行数:9,代码来源:differenceofgaussian.cpp

示例6: localvariance

ImageFeature localvariance(const ImageFeature &image, const uint winsize) {
  ImageFeature result(image.xsize(),image.ysize(),1);

  for(uint x=winsize;x<image.xsize()-winsize;++x) {
    for(uint y=winsize;y<image.ysize()-winsize;++y) {
      result(x,y,0)=localvariance(image, winsize, x,y);
    }
  }
  return result;
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:10,代码来源:imagelib.cpp

示例7: setPatch

void setPatch(ImageFeature& image, const uint xpos, const uint ypos, const ImageFeature &patch) {
  DBG(50) << "set image patch from (" << xpos << "," << ypos << ") to (" << xpos+patch.xsize() << "," << ypos+patch.ysize() << ") " << endl;
  for(uint x=0;x<patch.xsize();++x) {
    for(uint y=0;y<patch.ysize();++y) {
      for(uint z=0;z<patch.zsize();++z) {
        if(x+xpos<image.xsize() && y+ypos<image.ysize()) {
          image(x+xpos,y+ypos,z)=patch(x,y,z);
        }
      }
    }
  }
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:12,代码来源:imagelib.cpp

示例8: multiply

void multiply(ImageFeature &img1, const ImageFeature& img2) {
  if ((img1.xsize() != img2.xsize()) ||
      (img1.ysize() != img2.ysize()) ||
      (img1.zsize() != img2.zsize())) {
    DBG(10) << "image features have different sizes, cannot be multiplied.";
  }
  for (uint z = 0; z < img1.zsize(); z++)
    for (uint x = 0; x < img1.xsize(); x++)
      for (uint y = 0; y < img1.ysize(); y++) {
	img1(x, y, z) = img1(x, y, z) * img2(x, y, z);
      }
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:12,代码来源:imagelib.cpp

示例9: rotate90

ImageFeature rotate90(const ImageFeature &img) {
  uint X=img.xsize();
  ImageFeature result(img.ysize(),img.xsize(),img.zsize());
    for(uint x=0;x<img.ysize();++x) {
      for(uint y=0;y<img.xsize();++y) {
        for(uint z=0;z<img.zsize();++z) {
          result(x,y,z)=img(y,X-x-1,z);
        }
      }
    }
  return result;
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:12,代码来源:imagelib.cpp

示例10: zeropad

ImageFeature zeropad(const ImageFeature& image, uint xpad, uint ypad) {
  ImageFeature result(image.xsize()+2*xpad, image.ysize()+2*ypad, image.zsize());
  
  for(uint x=xpad;x<image.xsize()+xpad;++x) {
    for(uint y=ypad;y<image.ysize()+ypad;++y) {
      for(uint c=0;c<image.zsize();++c) {
        result(x,y,c)=image(x-xpad,y-ypad,c);
      }
    }
  }
  return result;
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:12,代码来源:imagelib.cpp

示例11: flip

ImageFeature flip(const ImageFeature &img) {
  ImageFeature result(img.xsize(),img.ysize(),img.zsize());
  
  for(uint x=0;x<img.xsize();++x) {
    for(uint y=0;y<img.ysize();++y) {
      for(uint z=0;z<img.zsize();++z) {
        result(img.xsize()-x-1,y,z)=img(x,y,z);
      }
    }
  }
  return result;
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:12,代码来源:imagelib.cpp

示例12: localEntropy

ImageFeature localEntropy(const ImageFeature &image, const uint winsize) {
  ImageFeature result(image.xsize(), image.ysize(), image.zsize());
  
  for(uint x=0;x<image.xsize();++x) {
    for(uint y=0;y<image.ysize();++y) {
      for(uint z=0; z<image.zsize();++z) {
        result(x,y,z)=localEntropy(image, x,y,z,winsize);
      }
    }
  }
  
  return result;
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:13,代码来源:imagelib.cpp

示例13: meanandvariance

void meanandvariance(const ImageFeature &img, double &mean, double &variance, const uint layer) {
  mean=0.0; variance=0.0;
  for(uint y=0;y<img.ysize();++y) {
    for(uint x=0;x<img.xsize();++x) {
      mean+=img(x,y,layer);
      variance+=img(x,y,layer)*img(x,y,layer);
    }
  }

  uint size=img.xsize()*img.ysize();

  mean/=double(size);
  variance/=double(size);
  variance-=mean*mean;
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:15,代码来源:imagelib.cpp

示例14: threshold

ImageFeature threshold(const ImageFeature &image, const double threshold) {
  ImageFeature result(image.xsize(), image.ysize(), image.zsize());
  for(uint x=0;x<image.xsize();++x) {
    for(uint y=0;y<image.ysize();++y) {
      for(uint z=0;z<image.zsize();++z) {
        if(image(x,y,z)>=threshold) {
          result(x,y,z)=1.0;
        } else {
          result(x,y,z)=0.0;
        }
      }
    }
  }
  return result;
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:15,代码来源:imagelib.cpp

示例15: SamplesToCoefficients

InterpolatingImage::InterpolatingImage(const ImageFeature& image, uint splinedegree) : sourceImage_(image), splinedegree_(splinedegree) {
#ifdef HAVE_INTERPOL_LIBRARY
    coeff_=new float*[image.zsize()];
    for(uint i=0; i<image.zsize(); ++i) {
        coeff_[i]=new float[image.xsize()*image.ysize()];
        for(uint x=0; x<image.xsize(); ++x) {
            for(uint y=0; y<image.ysize(); ++y) {
                coeff_[i][y*image.xsize()+x]=float(image(x,y,i));
            }
        }
        SamplesToCoefficients(coeff_[i],image.xsize(),image.ysize(),splinedegree);
    }
#endif


}
开发者ID:kjarosz,项目名称:cuda_udat,代码行数:16,代码来源:interpolatingimage.cpp


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