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

VectorReal64 Impala::Core::Feature::VisSem::DoSpatialPyramid ( Geometry::Rectangle  rect,
VectorReal64  vec 
) [inline, private]

Definition at line 412 of file VisSem.h.

References Impala::Core::Feature::Computor::mLazebnikPyramid, Impala::Core::Geometry::RectanglePyramidPerDim::NrLevels(), Impala::Core::Geometry::RectanglePyramidPerDim::NrRects(), Impala::Core::Geometry::RectanglePyramidPerDim::Rect(), Impala::Core::Vector::VectorTem< ElemT >::Size(), and Impala::Core::Geometry::RectanglePyramidPerDim::TotalNrRects().

Referenced by ComputeFeaturesPixelSet(), and DoSpatialPyramid().

00413     {
00414         VectorReal64 res(vec.Size() * mLazebnikPyramid.TotalNrRects());
00415         res = 0.0;
00416 
00417         int levelBase = 0;
00418         double normVal = 1.0; // normalization of the pyramid levels
00419         // construct pyramid backwards, to deal with normalization
00420         for (int level=mLazebnikPyramid.NrLevels()-1 ; level>=0 ; level--)
00421         {
00422             // set lazebnik spatial pyramid normalization proportial
00423             // to the number of cells (as Lazebnik does)
00424             if (level != mLazebnikPyramid.NrLevels() - 1)
00425             {
00426                 normVal = normVal / ((double)mLazebnikPyramid.NrRects(level+1) /
00427                                      mLazebnikPyramid.NrRects(level));
00428             }
00429 
00430             int nrRect = mLazebnikPyramid.NrRects(level);
00431             for (int r=0 ; r<nrRect ; r++)
00432             {
00433                 Geometry::Rectangle rectLazeb = mLazebnikPyramid.Rect(level, r);
00434                 // if rect intersects with rectLazebnik, add it to the
00435                 // lazebnikpyramid-bin. This allows putting overlapping
00436                 // regions in multiple lazebnikpyramid-bins.
00437                 if (rectLazeb.Intersects(rect))
00438                 {
00439                     int rectBase = levelBase + r * vec.Size();
00440                     for (int i=0 ; i<vec.Size()  ; i++)
00441                     {
00442                         // do normVal squared, cause later the Vector::Avg is
00443                         // taken, with a lot of zeros which will counterbalance
00444                         // normVal once (leaving one)
00445                         res[rectBase + i] = vec[i] * normVal * normVal;
00446                     }
00447                 }
00448             }
00449             levelBase += nrRect * vec.Size();
00450         }
00451         return res;
00452     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:11:15 2010 for ImpalaSrc by  doxygen 1.5.1