Ejemplo n.º 1
0
////////////////////////////////////////////////////////
// Filterbank Functions - BEGIN
////////////////////////////////////////////////////////
Filterbank * CreateFilterbank( int sze ){

  Filterbank * pFilterbank = NULL;
  pFilterbank = (Filterbank*)calloc(1, sizeof(Filterbank));
  assert(pFilterbank!=NULL);

  pFilterbank->m_pSpectralFilterBank = NULL;
  pFilterbank->m_pSpectralFilterBank = (Spectrum**)calloc(NSCALES*NORIENTATIONS,sizeof(Spectrum*));
  assert(pFilterbank!=NULL);

  gabor * pGabor = NULL;
  register int s, k;

  for( s = 0; s < NSCALES; s++ ){
    for( k = 0; k < NORIENTATIONS; k++ ){

      pGabor = CreateGabor( sze );
      assert(pGabor!=NULL);
      gaborFilter(pGabor, s+1, k+1);

      pFilterbank->m_pSpectralFilterBank[s*NORIENTATIONS+k] = DFFT2DWithImag(pGabor->m_pReal, pGabor->m_pImag);
      DestroyGabor(&(pGabor));
    }
  }

  pFilterbank->m_pFeatures = NULL;
  return (pFilterbank);
}
Ejemplo n.º 2
0
/*!
    \fn CvGaborFeature::val(const IplImage *img)
 */
double CvGaborFeature::val(const IplImage *img)
{
    CreateGabor();
    
    double ve;
    
    IplImage *reimg = cvCreateImage(cvSize(img->width,img->height), IPL_DEPTH_32F, 1);
    gabor->conv_img(img, reimg, CV_GABOR_MAG);
    
  
    ve = cvGetReal2D((IplImage*)reimg, iy-1, ix-1);
    cvReleaseImage(&reimg);
    clear();
    return ve;
}
Ejemplo n.º 3
0
/*!
    \fn CvGaborFeature::val(const IplImage* img, int scale)
 */
double CvGaborFeature::val(const IplImage* img, int scale)
{
  CvSize size = cvGetSize( img );
  int width = size.width;
  int height = size.height;
  
  int div = scale + 1;
  double dwidth = (double)(width)/pow((double)2, (double)div);
  double dheight = (double)(height)/pow((double)2,(double)div);
  int rewidth = (int)ceil(dwidth);
  int reheight = (int)ceil(dheight);
  
  
  
  //double ve = val(reimg);
  
  CreateGabor();
  
  double ve;
  
  IplImage *magimg = cvCreateImage(cvSize(img->width,img->height), IPL_DEPTH_32F, 1);
  gabor->conv_img(img, magimg, CV_GABOR_MAG);
  //cvSave("reimg2.xml", (IplImage*)magimg, NULL, NULL, cvAttrList());
  IplImage * reimg = cvCreateImage(cvSize(rewidth, reheight), IPL_DEPTH_32F, 1);
  cvResize( magimg, reimg, CV_INTER_CUBIC );
  // cvSave("simg2.xml", (IplImage*)reimg, NULL, NULL, cvAttrList());
  ve = cvGetReal2D((IplImage*)reimg, iy-1, ix-1);
  cvReleaseImage(&reimg);
  clear();
  cvReleaseImage(&magimg);
  return ve;
  
  
  
  cvReleaseImage( &reimg );
  //cvReleaseImage( &img );
  return ve;
}