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

void Impala::Core::Array::VisSemGabor ( ArraySet< Array2dScalarReal64 > &  res,
Array2dVec3UInt8 *  rgb,
double  scale,
double  freq,
int  nrOrient 
) [inline]

Definition at line 29 of file VisSemGabor.h.

References Impala::Core::Array::ArraySet< ArrayT >::Array(), Div(), M_PI, Mul(), Norm2(), ProjectRange(), RecGabor(), RecGauss(), Rgb2Ooo(), Set(), and Threshold().

Referenced by Impala::Core::Feature::VisSem::ComputePixelFeatureSet().

00031 {
00032 
00033     // hack : hard coded for nrOrient == 4
00034     // this will keep arrays in a specific order if the set is empty:
00035     res.Array("gaborW0");
00036     res.Array("gaborWl0");
00037     res.Array("gaborWll0");
00038     res.Array("gaborW45");
00039     res.Array("gaborWl45");
00040     res.Array("gaborWll45");
00041     res.Array("gaborW90");
00042     res.Array("gaborWl90");
00043     res.Array("gaborWll90");
00044     res.Array("gaborW135");
00045     res.Array("gaborWl135");
00046     res.Array("gaborWll135");
00047     res.Array("Wl");
00048     res.Array("Wll");
00049 
00050     if (!rgb)
00051         return; // call was to figure out what would be the result
00052 
00053     // set the different orientations
00054     double* orients = new double[nrOrient];
00055     orients[0] = 0;
00056     for (int i=1 ; i<nrOrient; i++)
00057         orients[i] = orients[i-1] + M_PI/nrOrient;
00058 
00059     // convert to opponent color space
00060     Array2dVec3Real64* ooo = 0;
00061     Rgb2Ooo(ooo, rgb);
00062 
00063     // declare and initialize temporary images
00064     Array2dScalarReal64* E_0_SR64 = 0;
00065     Array2dComplex64* E_0_C64 = 0;
00066     Array2dComplex64* gabor = 0;
00067     Array2dScalarReal64* tmp_SR64 = 0;
00068     Array2dComplex64* tmp_C64 = 0;
00069 
00070     // init each color channel
00071     Array2dScalarReal64* imOOO_SR64[3];
00072     Array2dComplex64* imOOO_C64[3];
00073     for (int ii=0 ; ii<3 ; ii++) {
00074         imOOO_SR64[ii] = 0;
00075         ProjectRange(imOOO_SR64[ii], ooo, ii+1);
00076         imOOO_C64[ii] = 0;
00077         Set(imOOO_C64[ii], imOOO_SR64[ii]);
00078     }
00079 
00080     // creat a smooth intensity image
00081     RecGauss(E_0_SR64, imOOO_SR64[0], scale, scale, 0, 0, 3);
00082 
00083     // create a threshold image, since we divide by intensity, threshold on low intensity
00084     int thresholdVal = 15;
00085     Array2dScalarReal64* threshE_0_SR64 = 0;
00086     Threshold(threshE_0_SR64, E_0_SR64, thresholdVal);
00087     //Real64 sum;
00088     //Real64 nr;
00089     //PixStatBasic(threshE_0_SR64, &nr, &sum, (Real64*) 0, (Real64*) 0);
00090     //std::cout << "threshold: nr = " << nr << ", sum = " << sum << std::endl;
00091 
00092     // get a list of all gabor responses
00093     //std::vector<CxArray2dScalarReal64*> imList;
00094     int cur = 0;
00095 
00096     // first, texture
00097     for (int oi=0; oi<nrOrient; oi++)
00098     {
00099         // with W invariant, use the intensity channel
00100         for (int pixDim=0;pixDim<3 ; pixDim++)
00101         {
00102             //std::cout << "gabor pixdim " << pixDim << ", orient " << oi << std::endl;
00103             Set(tmp_C64, imOOO_SR64[pixDim]);
00104             RecGabor(gabor, tmp_C64, scale, freq, orients[oi]);
00105 
00106             // convert complex nr. to real nr, by the magnitude
00107             //Array2dScalarReal64* res = 0;
00108             Norm2(res.Array(cur), gabor);
00109 
00110             // with  W invariant divide by smooth intensity E_0 after Gabor filtering
00111             Div(res.Array(cur), res.Array(cur), E_0_SR64);
00112 
00113             //smooth
00114             //RecGauss(res.Array(cur), res.Array(cur), 1.95*scale, 1.95*scale,0, 0, 3);
00115 
00116             // threshold the low intensity values, since we divide by intensity
00117             Mul(res.Array(cur), res.Array(cur), threshE_0_SR64);
00118 
00119             // add to result-list
00120             //imList.push_back(res);
00121             cur++;
00122 
00123         } // end for pixDim
00124     } // end for(orientation)
00125 
00126     // now, add color information.
00127 
00128     // dividing by E makes the intensity for the W invariant E/E =1,
00129     // so we can leave E out.
00130     for (int pixDim=1 ; pixDim<3 ; pixDim++)
00131     {
00132         //Array2dScalarReal64* res = 0;
00133 
00134         RecGauss(res.Array(cur), imOOO_SR64[pixDim], scale, scale, 0, 0, 3);
00135 
00136         // with W invariant divide by smooth intensity E_0
00137         Div(res.Array(cur), res.Array(cur), E_0_SR64);
00138 
00139         // threshold the low intensity values, since we divide by intensity
00140         Mul(res.Array(cur), res.Array(cur), threshE_0_SR64);
00141 
00142         //imList.push_back(res);
00143         cur++;
00144     } // end for pixDim
00145 
00146     // clean up
00147     delete orients;
00148     for (int j=0 ; j<3 ; j++) {
00149         delete imOOO_SR64[j];
00150         delete imOOO_C64[j];
00151     }
00152     delete E_0_SR64;
00153     delete E_0_C64;
00154     delete gabor;
00155     delete tmp_SR64;
00156     delete tmp_C64;
00157     delete threshE_0_SR64;
00158     delete ooo;
00159 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:58:47 2010 for ImpalaSrc by  doxygen 1.5.1