Definition at line 306 of file Sift.h. References Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Add(), Impala::Core::Array::AddVal(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get1(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get2(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get3(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get4(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get5(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get6(), ILOG_DEBUG, ILOG_INFO, Impala::Core::Geometry::LINEAR, Impala::MakeQuid(), mDescriptorBinCount, mDescriptorLength, mDescriptorRegDiv, mDescriptorWindowSize, mFeatureTable, mGaussian, mGradAng, mGradMag, mKeyPoints, mLevelCnt, PI, Impala::Core::Array::Rotate(), Impala::Core::Array::SetVal(), Impala::Application::DemoCamera2d::sigma, and Impala::Core::Table::Table::Size(). Referenced by ExtractDescriptors(). 00307 { 00308 ILOG_DEBUG("Extracting Descriptors") 00309 int k=0; 00310 00311 Array2dScalarReal64 *GM,*GA,*Gaussian; 00312 int o,l,i,j,index; 00313 Real64 ori, sigma; 00314 int range = mGaussian->CW()/2; 00315 int range_ext= range*sqrt(2)+1; 00316 KeyPointTableType* oldKeyPoints=mKeyPoints; 00317 int size = oldKeyPoints->Size(); 00318 int current = 0; 00319 mFeatureTable = new FeatureTable(FeatureDefinition("SIFT"),size,mDescriptorLength); 00320 00321 00322 mKeyPoints=new KeyPointTableType(0); 00323 while(k<size) 00324 { 00325 if(!((oldKeyPoints->Get2(k)==0)&&(oldKeyPoints->Get3(k)==0))){ 00326 sigma= oldKeyPoints->Get1(k); 00327 i = oldKeyPoints->Get2(k); 00328 j = oldKeyPoints->Get3(k); 00329 o = oldKeyPoints->Get4(k); 00330 l = oldKeyPoints->Get5(k); 00331 ori = oldKeyPoints->Get6(k); 00332 index=o*mLevelCnt+l; 00333 mKeyPoints->Add(sigma,i,j,o,l,ori); 00334 GA=mGradAng[index]; 00335 GM=mGradMag[index]; 00336 00337 //Weight the gradient magnitudes with a gaussian, 00338 // with a sigma 1.5 * descriptor window size 00339 // and centered around the keypoint 00340 00341 00342 //Rotate 00343 Array2dScalarReal64 *srcGA=ArrayCreate<Array2dScalarReal64> 00344 (mDescriptorWindowSize,mDescriptorWindowSize); 00345 Array2dScalarReal64 *srcGM=ArrayCreate<Array2dScalarReal64> 00346 (mDescriptorWindowSize,mDescriptorWindowSize); 00347 Array2dScalarReal64 *dstGA=0; 00348 Array2dScalarReal64 *dstGM=0; 00349 SetVal(srcGA,0); 00350 SetVal(srcGM,0); 00351 00352 00353 //mHistogram Bin Count 00354 double histAng[16*mDescriptorBinCount]; 00355 for(int h=0;h<16*mDescriptorBinCount;h++) 00356 histAng[h]=0; 00357 double incr=PI/mDescriptorBinCount; 00358 bool clipped=false; 00359 00360 for(int x = -mDescriptorWindowSize/2; 00361 x < mDescriptorWindowSize/2; x++) 00362 { 00363 for(int y =-mDescriptorWindowSize/2; 00364 y <mDescriptorWindowSize/2; y++) 00365 { 00366 if((i+x<0)||(i+x>GA->CW())|| 00367 (j+y<0)||(j+y>GA->CH())){ 00368 clipped=true; 00369 continue; 00370 } 00371 srcGA->SetValue(GA->Value(i+x,j+y), 00372 x+mDescriptorWindowSize/2, 00373 y+mDescriptorWindowSize/2); 00374 srcGM->SetValue(GM->Value(i+x,j+y), 00375 x+mDescriptorWindowSize/2, 00376 y+mDescriptorWindowSize/2); 00377 00378 } 00379 00380 } 00381 00382 Rotate(dstGA,srcGA,ori*180/PI,Geometry::LINEAR,true,0); 00383 AddVal(dstGA,dstGA,ori); 00384 00385 Rotate(dstGM,srcGM,ori*180/PI,Geometry::LINEAR,true,0); 00386 00387 for(int hx=0;hx<mDescriptorRegDiv;hx++){//hx and hy are divs 00388 for(int hy=0;hy<mDescriptorRegDiv;hy++){ 00389 for(int ix=0;ix<dstGA->CW()/mDescriptorRegDiv;ix++){ 00390 for(int iy=0;iy<dstGA->CH()/mDescriptorRegDiv;iy++){ 00391 int x=hx*mDescriptorRegDiv+ix; 00392 int y=hy*mDescriptorRegDiv+iy; 00393 if(dstGA->Value(x,y)>PI/2) 00394 dstGA->SetValue(dstGA->Value(x,y)-PI/2,x,y); 00395 if(dstGA->Value(x,y)<0) 00396 dstGA->SetValue(dstGA->Value(x,y)+PI/2,x,y); 00397 00398 int bin=floor(mDescriptorBinCount/2+ 00399 dstGA->Value(x,y)/incr); 00400 00401 if(bin>mDescriptorBinCount) 00402 continue; 00403 if(bin<0) 00404 continue; 00405 //The descriptor is stored as 4x4 regions, and 8 00406 //histogram bins 00407 00408 histAng[mDescriptorRegDiv*mDescriptorBinCount*hx+ 00409 mDescriptorBinCount*hy+ 00410 bin] 00411 += mGaussian->Value(x,y) * dstGM->Value(x,y); 00412 00413 } 00414 00415 } 00416 } 00417 } 00418 mFeatureTable->GetColumn1()->Set(current++,MakeQuid(0,0,0,k)); 00419 //the size of the feature depends on the number of binws in the 00420 //histograms, and the square of the region( default:8bins-4 x 4) 00421 mFeatureTable->GetColumn2()->AddVector( histAng, 00422 mDescriptorLength ); 00423 00424 } 00425 k++; 00426 } 00427 ILOG_INFO("Total Keypoint Count:"<<mKeyPoints->Size()); 00428 00429 00430 }
Here is the call graph for this function:
|