Generate a kernel image resembling a Gaussian. WARNING: jan-mark thinks it works only for 0th order and 2nd order mixed derivative Definition at line 29 of file MakeGaussian2d.h. Referenced by Impala::Core::KeyPoint::Sift::BuildGaussians(), GaussDerivative2d(), and Impala::Core::KeyPoint::Sift::Init(). 00030 { 00031 int xx, yy, width, height; 00032 double l, divido; 00033 00034 phi = phi*M_PI/180.0; 00035 if (phi == 0.0) { 00036 width = (int)(n*st); 00037 height = (int)(n*sr); 00038 } else { 00039 l = sqrt(sr*sr/(cos(phi)*cos(phi)) + st*st/(sin(phi)*sin(phi))); 00040 width = (int)(n*ABS(st*st/tan(phi) + sr*sr*tan(phi))/l + 0.5); 00041 l = sqrt(st*st/(cos(phi)*cos(phi)) + sr*sr/(sin(phi)*sin(phi))); 00042 height = (int)(n*ABS(sr*sr/tan(phi) + st*st*tan(phi))/l + 0.5); 00043 } 00044 divido = 1./(2*M_PI*sr*st); 00045 00046 double* fData = new double[(2*width+1) * (2*height+1)]; 00047 00048 int i=0; 00049 for (yy=0; yy<2*height+1; yy++) { 00050 for (xx=0; xx<2*width+1; xx++) { 00051 if (dert==2) { 00052 divido = (pow((cos(phi)*(xx-width)+sin(phi)*(yy-height))/st, 00053 2.0)-1.)/(2*M_PI*sr*st*st); 00054 } 00055 fData[i] = (double)(divido * exp(-0.5 * 00056 (pow(( cos(phi)*(xx-width)+sin(phi)*(yy-height))/st,2.0)+ 00057 pow((-sin(phi)*(xx-width)+cos(phi)*(yy-height))/sr,2.0)))); 00058 i++; 00059 } 00060 } 00061 return ArrayCreate<Array2dScalarReal64>(2*width+1, 2*height+1, 0, 0, fData); 00062 }
|