Generate a Gabor kernel for recursive implementation. Adapted to Horus: Jan van Gemert and Jan-Mark Geusebroek Orignal Author: Lucas J. van Vliet Delft University of Technology Title: Recursive Gabor filtering Authors: I.T. Young, L.J. van Vliet, M. van Ginkel in: A. Sanfeliu, J.J. Villanueva, M. Vanrell, R. Alquezar, T. Huang, J. Serra (eds.), ICPR15, Proc. 15th Int. Conference on Pattern Recognition (Barcelona, Spain, Sep.3-7), vol. 3, Image, Speech, and Signal Processing, IEEE Computer Society Press, Los Alamitos, 2000, 342-345. Also published in:
http://www.ph.tn.tudelft.nl/~lucas/publications/2000/ICPR2000TYLVMG/ICPR2000TYLVMG.html Definition at line 40 of file MakeGaborIIR1d.h. References Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CPB(). Referenced by Impala::Samples::Timing::DoOneRecConvSepComlex(), and RecGabor(). 00042 { 00043 int size = 7; 00044 double _re[7]; 00045 double _im[7]; 00046 00047 // do the 'recipe' in the article 00048 00049 // initial values 00050 double m0 = 1.16680, m1 = 1.10783, m2 = 1.40586 ; 00051 double m1sq = m1*m1, m2sq = m2*m2 ; 00052 00053 // calculate q 00054 double q ; 00055 if(sigma < 3.556) 00056 q = -0.2568 + 0.5784 * sigma + 0.0561 * sigma * sigma ; 00057 else 00058 q = 2.5091 + 0.9804 * (sigma - 3.556) ; 00059 00060 double qsq = q*q ; 00061 00062 // calculate scale, and b[0,1,2,3] 00063 double scale = (m0 + q) * (m1sq + m2sq + 2*m1*q + qsq) ; 00064 double b0 = 1 ; 00065 double b1 = -q * (2*m0*m1 + m1sq + m2sq + (2*m0 + 4*m1) * q + 3*qsq) / scale ; 00066 double b2 = qsq * (m0 + 2*m1 + 3*q) / scale ; 00067 double b3 = - qsq * q / scale ; 00068 00069 // calculate B, without the ^2, this because horus uses the middle value of 00070 // the filter both for left and right parts of the recursion 00071 double B = (m0 * (m1sq + m2sq))/scale ; 00072 00073 // create filter, 00074 // yet, as we use addAssign, and the article uses subAssign, 00075 // we use the negative values 00076 _re[0] = -b3 * cos(3*omega0) ; _im[0] = -b3 * sin(3*omega0) ; 00077 _re[1] = -b2 * cos(2*omega0) ; _im[1] = -b2 * sin(2*omega0) ; 00078 _re[2] = -b1 * cos(omega0) ; _im[2] = -b1 * sin(omega0) ; 00079 _re[3] = B ; _im[3] = 0 ; 00080 _re[4] = _re[2] ; _im[4] = -_im[2] ; 00081 _re[5] = _re[1] ; _im[5] = -_im[1] ; 00082 _re[6] = _re[0] ; _im[6] = -_im[0] ; 00083 00084 00085 // create border coefficients as done in the article, 00086 double leftReal = 1.0 - _re[2] - _re[1] - _re[0] ; 00087 double leftImaginary = - _im[2] - _im[1] - _im[0] ; 00088 00089 double rightReal = 1.0 - _re[4] - _re[5] - _re[6] ; 00090 double rightImaginary = - _im[4] - _im[5] - _im[6] ; 00091 00092 borderIn = Complex64(leftReal,leftImaginary) ; 00093 borderOut = Complex64(rightReal,rightImaginary) ; 00094 00095 Complex64 complexB(B,0); 00096 Complex64 one(1.0,0.0) ; 00097 00098 // normalize the 'in' filter also for B, as horus uses B also for the 'in' part. 00099 borderIn = complexB / borderIn ; 00100 borderOut = complexB / borderOut ; 00101 00102 //Complex* result = new Complex[7]; 00103 Array2dComplex64* result = ArrayCreate<Array2dComplex64>(7, 1); 00104 Real64* ptr = result->CPB(0, 0); 00105 for (int i=0 ; i<7 ; i++) 00106 { 00107 //result[i] = Complex(_re[i], _im[i]); 00108 *ptr++ = _re[i]; 00109 *ptr++ = _im[i]; 00110 } 00111 return result; 00112 }
Here is the call graph for this function:
|