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

void Impala::Core::Feature::CalculateRegionDescriptors ( Array::Array2dVec3UInt8 *  inputNoBorder,
Geometry::InterestPointList &  pointList,
String  descriptor 
)

Definition at line 404 of file RegionDescriptor.h.

References Impala::Core::Array::ArrayListDelete(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CH(), ComputeRegionDescriptor(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CW(), Impala::Core::Array::Pattern::FuncBorderMirror2d(), Impala::Core::Array::GaussDerivative(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetInt(), Impala::Core::Array::MakeFrom3Images(), MakePatch(), Impala::Core::Array::MakeRoi(), and Impala::Core::Array::ProjectRange().

Referenced by Impala::Core::Feature::InterestPointFeature::ComputeDescriptors().

00407 {
00408     using namespace Impala::Core::Array;
00409     using namespace Impala::Core::Geometry;
00410 
00411     // start of descriptor computation code
00412     Real64 scaleMultiplier = 10;     // used to be 4
00413     Real64 extraBorder = 120;
00414     
00415     Array2dVec3UInt8* input =
00416         ArrayCreate<Array2dVec3UInt8>(inputNoBorder->CW(), inputNoBorder->CH(), extraBorder, extraBorder);
00417     MakeFromData2<Array2dVec3UInt8,Array2dVec3UInt8>(input, inputNoBorder);
00418     /* now mirror the data into the border */
00419     Pattern::FuncBorderMirror2d(input, extraBorder, extraBorder);
00420 
00421     /* support bin count changing */
00422     CmdOptions& options = CmdOptions::GetInstance();
00423     if(options.GetInt("descriptorPreSmoothing") != 0) {
00424         /* pre-smooth the input */
00425         Real64 sigmaSmooth = 1.0;
00426 
00427         std::vector<Array2dScalarReal64*> resList;
00428         for (int d=1 ; d<=input->ElemSize() ; d++)
00429         {
00430             Array2dScalarReal64* comp = 0;
00431             ProjectRange(comp, input, d);
00432             GaussDerivative(comp, comp, sigmaSmooth, 0, 0, 3.0);
00433             resList.push_back(comp);
00434             delete comp;
00435         }
00436         delete input;
00437         input = 0;
00438         MakeFrom3Images(input, resList[0], resList[1], resList[2]);
00439         ArrayListDelete(&resList);
00440     }
00441 
00442     //ArraySystem::Instance().MarkMemoryUsage(true);          // DEBUG
00443     for(InterestPointList::iterator iter = pointList.begin(); iter != pointList.end(); iter++)
00444     {
00445         // make it a reference, because we want to modify it in-place
00446         InterestPoint* point = *iter;
00447         
00448         if(point->geometryType() == "CircleZ") {
00449             /* cast to a circle */
00450             InterestCircle* circle(dynamic_cast<InterestCircle*>(point));
00451 
00452             /* this code makes the (very strong) assumption that (X,Y) are integers, which is true in the interest point datastructure */
00453             int pixelsAround = floor(circle->mScale * scaleMultiplier + 0.5);
00454             Array2dVec3UInt8* patch = 0;
00455             int x = floor(circle->mX + 0.5);
00456             int y = floor(circle->mY + 0.5);
00457                     
00458             MakePatch(patch, input, x, y, pixelsAround);
00459             
00460             /* compute a descriptor over the patch */
00461             // do not clear it first, then I cannot concatenate descriptors!
00462             //point->mDescriptor.clear();
00463 
00464             //std::cout << "--new point with scale: " << circle->mScale << std::endl;
00465             ComputeRegionDescriptor(circle->mDescriptor, patch, descriptor, true, x, y);
00466 
00467             delete patch;
00468         } else if(point->geometryType() == "RectangleZ") {
00469             /* cast to a rectangle */
00470             InterestRectangleZ* rectangle(dynamic_cast<InterestRectangleZ*>(point));
00471 
00472             /* this code makes the (very strong) assumption that (X,Y) are integers, which is true in the interest point datastructure */
00473             Array2dVec3UInt8* patch = MakeRoi(input, rectangle->GetRect());
00474                    
00475             /* compute a descriptor over the patch; do *not* use a circular mask */
00476             // do not clear it first, then I cannot concatenate descriptors!
00477             //point->mDescriptor.clear();
00478 
00479             ComputeRegionDescriptor(rectangle->mDescriptor, patch, descriptor, false, rectangle->mX, rectangle->mY);
00480 
00481             delete patch;
00482         } else {
00483             throw "[CalculateDescriptors] Unknown geometry type: " + point->geometryType();
00484         }
00485         //ArraySystem::Instance().MemoryUsageSinceMark(true);     // DEBUG
00486     }
00487     delete input;
00488 }

Here is the call graph for this function:


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