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

void Impala::Core::KeyPoint::Sift::AssignOrientation (  )  [inline]

Definition at line 204 of file Sift.h.

References Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Add(), 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::KeyPoint::Detector::GetKeyPoints(), ILOG_INFO, mDetector, mGaussians, mGradAng, mGradMag, mKeyPoints, mLevelCnt, PI, Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Set6(), Impala::Application::DemoCamera2d::sigma, and Impala::Core::Table::Table::Size().

Referenced by ExtractDescriptors().

00205     {
00206         
00207         double sigma;
00208         int range=0;
00209         int k=0;
00210         int o,l,i,j,index;
00211         Array2dScalarReal64 *GA, *GM;
00212         Array2dScalarReal64 *Gaussian;
00213 
00214         mKeyPoints=mDetector->GetKeyPoints();
00215         int OrigSize = mKeyPoints->Size();
00216         while(k<OrigSize)
00217         {
00218             sigma= mKeyPoints->Get1(k);
00219             i = mKeyPoints->Get2(k);
00220             j = mKeyPoints->Get3(k);
00221             o = mKeyPoints->Get4(k);
00222             l = mKeyPoints->Get5(k);
00223             index=o*mLevelCnt+l;
00224 
00225             GA=mGradAng[index];
00226             GM=mGradMag[index];
00227             Gaussian=mGaussians[index];
00228             //Weight the gradient magnitudes with a gaussian,
00229             // with a sigma 1.5 times the original,
00230             // and centered around the keypoint
00231             range = Gaussian->CW()/2;
00232             
00233             double histAng[36];
00234             for(int h=0;h<36;h++)
00235                 histAng[h]=0;
00236             double incr=PI/36;
00237 
00238             for(int x=-range;x<range+1;x++)
00239             {
00240                 for(int y=-range;y<range+1;y++)
00241                 {
00242                     if((i+x<0)||(i+x>GA->CW())||
00243                        (j+y<0)||(j+y>GA->CH()))
00244                         continue;
00245                     if((x+range>=Gaussian->CW()||y+range>=Gaussian->CH()))
00246                         continue;
00247                     int bin=floor(18+GA->Value(i+x,j+y)/incr);
00248                     if(bin>36)
00249                         continue;
00250                     histAng[bin]+=Gaussian->Value(x+range,y+range) *
00251                                                GM->Value(i+x,j+y);
00252                 }
00253             
00254             }
00256             //Find the maximum in the histogram
00257             double max_val=0;
00258             int max_bin=0;
00259             for(int b=0;b<36;b++)
00260             {
00261                 if(histAng[b]>max_val)
00262                 {
00263                     max_val = histAng[b];
00264                     max_bin=b;
00265                 }
00266             }
00267             mKeyPoints->Set6(k,-PI/2+incr*(max_bin+.5));
00269             //Update the Orientation of the keypoint to max_bin
00270             double low,high;
00271             low=-PI/2+incr*max_bin;
00272             high=-PI/2+incr*(max_bin+1);
00273             //ILOG_DEBUG("Orientation("<<max_bin<<"):"<<histAng[max_bin]
00274             //        <<" Values btw "<<low<<"-"<<high);
00275 
00277             //Find other values which are greater than 80% of highest peak
00278             double max80= .8 * max_val;
00279             for(int b=1;b<35;b++)
00280             {
00281                 if(b==max_bin)
00282                     continue;
00283                 if(histAng[b]>max80)
00284                 {   
00286                     //Check if it is a peak
00287                     if((histAng[b]>histAng[b-1])&&(histAng[b]>histAng[b+1])){
00288                         //Create a new keypoint at the same location 
00289                         //with this orientation
00290                         //
00291                         //ILOG_DEBUG("Create New Keypoint With Orientation:"<<b<<"-"<<histAng[b]);
00292                         mKeyPoints->Add(sigma,i,j,o,l,-PI/2+incr*(b+.5));
00293                     }
00294                 }
00295             }
00297             //find 3 histogram values closest to each peak, and fit a parabola
00298             //for better accuracy
00299             
00300             k++;
00301         }
00302         ILOG_INFO("Total "<<mKeyPoints->Size()-OrigSize
00303                         <<" new orientations assigned!");
00304         return;
00305     }

Here is the call graph for this function:


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