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

void Impala::Core::Feature::CalculateRegionDescriptors ( Array::Array2dVec3UInt8 *  inputNoBorder,
PointDescriptorTable *  pointData,
String  descriptor 
)

Definition at line 409 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::Core::Feature::PointDescriptorTable::GetDescriptorData(), Impala::Core::Feature::PointDescriptorTable::GetDescriptorLength(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetInt(), Impala::Core::Feature::PointDescriptorTable::GetScale(), Impala::Core::Feature::PointDescriptorTable::GetX(), Impala::Core::Feature::PointDescriptorTable::GetY(), Impala::Core::Array::MakeFrom3Images(), MakePatch(), Impala::Core::Array::ProjectRange(), Impala::Core::Feature::PointDescriptorTable::SetDescriptorLength(), and Impala::Core::Table::Table::Size().

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

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

Here is the call graph for this function:


Generated on Thu Jan 13 09:19:05 2011 for ImpalaSrc by  doxygen 1.5.1