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

void Impala::Core::Feature::DSurf ( Array::Array2dScalarReal64 *  image,
Geometry::InterestPointList &  pointList,
int  sampleRate,
int  numberHaarSum,
int  spaciality 
)

image in, descriptors are added to pointList

Definition at line 68 of file DSurf.h.

References Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CH(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CW(), ExtractFeatureIntoVector(), HaarResponse(), ILOG_DEBUG, ILOG_VAR, Impala::Core::Array::IntegrateReduce(), and Impala::Core::Array::IntegrateReduceWeighted().

Referenced by CalculateSurfDescriptors().

00071 {
00072     ILOG_VAR(Impala.Core.Feature.DSurf);
00073     ILOG_DEBUG("image w="<< image->CW() <<", h="<< image->CH());
00074     /* In order to speed up processing reduce the image so one pixel has the
00075        same 'energy' as a block of sampleRate^2 pixels. */
00076     Array::Array2dScalarReal64* reduced = 0;
00077     IntegrateReduce(reduced, image, sampleRate);
00078     // haar responses
00079     std::vector<Array::Array2dScalarReal64*> haar = HaarResponse(reduced);
00080     delete reduced;
00081     // sum the haar responses into component of the surf feature
00082     std::vector<Array::Array2dScalarReal64*> components;
00083     int w = haar[0]->CW() / numberHaarSum;
00084     int h = haar[0]->CH() / numberHaarSum;
00085     for(int i=0 ; i<haar.size() ; ++i)
00086     {
00087         Array::Array2dScalarReal64* comp =
00088             new Array::Array2dScalarReal64(w, h, 0, 0);
00089         IntegrateReduceWeighted(comp, haar[i], numberHaarSum);
00090         components.push_back(comp);
00091         delete haar[i];
00092     }
00093     w = components[0]->CW();
00094     h = components[0]->CH();
00095     //now combine the components into actual surf features
00096     int nrFeatures = w*h;
00097     int sampleSize = sampleRate * numberHaarSum;
00098     int featureSize = sampleSize * spaciality;
00099     /* because the DSurf implementation does it's own sampling we need this loop
00100        to create the interest points with correct dimensions (actually only the
00101        middle point is needed) */
00102     if(pointList.size() == 0)
00103     {
00104         for(int y=0 ; y<=h-spaciality ; ++y)
00105         {
00106             for(int x=0 ; x<=w-spaciality ; ++x)
00107             {
00108                 int left=x*sampleSize;
00109                 int top =y*sampleSize;
00110                 Geometry::Rectangle r(left, top, left+featureSize, top+featureSize);
00111                 Geometry::InterestRectangleZ* ir =
00112                     new Geometry::InterestRectangleZ(r);
00113                 pointList.push_back(ir);
00114             }
00115         }
00116     }
00117     // here comes the actual creation of surf features
00118     /* we might speed this up as follows:
00119        - first allocate a double array for all features.
00120        - then loop over the component images sepqrately and write into the buffer.
00121          This might be faster because the component images are are accessed once.
00122        - then normalize all features and copy vectors into the point list.
00123     */
00124     Geometry::InterestPointList::iterator it = pointList.begin();
00125     for(int y=0 ; y<=h-spaciality ; ++y)
00126     {
00127         for(int x=0 ; x<=w-spaciality ; ++x)
00128         {
00129             Geometry::InterestPoint* ir = *it;
00130             it++;
00131             ExtractFeatureIntoVector(ir->mDescriptor, components, x, y, spaciality);
00132         }
00133     }
00134     for(int i=0 ; i<components.size() ; ++i)
00135         delete components[i];
00136 }

Here is the call graph for this function:


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