Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

MakeGabor.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_MakeGabor_h
00002 #define Impala_Core_Array_MakeGabor_h
00003 
00004 #include "Core/Array/Arrays.h"
00005 
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Array
00011 {
00012 
00013 Array2dScalarReal64*
00014 MakeGabor(int size, double sigma, double frequency, double orientation, bool symmetric)
00015 {
00016     Array2dScalarReal64* filter = new Array2dScalarReal64(size, size, 0, 0);
00017 
00018     double cr = cos(orientation);
00019     double sr = sin(orientation);
00020     int begin = size/2;
00021     int end = size - begin;
00022     for(int y=-begin ; y<end ; y++)
00023     {
00024         double* p = filter->CPB(0, y+begin);
00025         for(int x=-begin ; x<end ; x++)
00026         {
00027             if(symmetric)
00028                 *p = cos((x*cr + y*sr) / frequency) * exp(-(x*x + y*y) / (2*sigma*sigma));
00029             else
00030                 *p = sin((x*cr + y*sr) / frequency) * exp(-(x*x + y*y) / (2*sigma*sigma));
00031             p++;
00032         }
00033     }
00034 
00035     return filter;
00036 }
00037 
00038 
00039 }//namespace Impala
00040 }//namespace Core
00041 }//namespace Array
00042 
00043 #endif //Impala_Core_Array_MakeGabor_h
00044 

Generated on Fri Mar 19 09:30:48 2010 for ImpalaSrc by  doxygen 1.5.1