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

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

Definition at line 113 of file Sift.h.

References ILOG_INFO, mGradAng, mGradMag, mLevelCnt, mOctaveCnt, mOctaves, Normalize(), Impala::Core::Array::Set(), Impala::Core::Array::SetVal(), and Impala::Application::DemoCamera2d::sigma.

Referenced by ExtractDescriptors().

00113                                {
00114         double H[4];
00115         double G[2];
00116         double S[2];
00117 
00118         ILOG_INFO("Computing gradient field");
00119 
00120         //For every level, construct the gradient magnitude and angle map
00121         for(int o=0;o<mOctaveCnt;o++){
00122             for(int l=0;l<mLevelCnt;l++)
00123             {
00124                 Array2dScalarReal64* L = mOctaves->GetOctave(o,l);
00125                 Set(mGradMag[o*mLevelCnt+l],L);
00126                 SetVal(mGradMag[o*mLevelCnt+l],0);
00127                 Set(mGradAng[o*mLevelCnt+l],mGradMag[o*mLevelCnt+l]);
00128                 //dd stands for derivative distance..
00129                 int dd;
00130                 //The sigma to be calculated in the gradient comes from 
00131                 //the difference of gaussians, for which peaks are analysed
00132                 //in the sigma neighborhood. because of these two shifts, we
00133                 //have to use l+2
00134                 Real64 sigma=mOctaves->GetSigma(o,l+2);
00136                 // If resampling is enabled, we have already reduced 
00137                 // the scale by two at every octave(doubling of sigma). 
00138                 // Therefore the derivative is the immediate neighbors.
00139                 //
00140                 // Otherwise jump as much as 1 sigma for a derivative,
00141                 // since the images are not scaled down as well.
00142                 if(mOctaves->IsResamplingEnabled())
00143                     dd=1;
00144                 else
00145                     dd=sigma;
00146                 
00147                 for(int i=dd;i<L->CW()-dd;i++){
00148                 for(int j=dd;j<L->CH()-dd;j++){
00149                     //this is the first derivative wrt. x
00150                     //[ -1 0 1 ]
00151                     G[0] = L->Value(i+dd,j) - L->Value(i-dd,j);
00152 
00153                     //this is the first derivative wrt. y
00154                     G[1] = L->Value(i,j+dd) - L->Value(i,j-dd);
00155                     
00156                     mGradMag[o*mLevelCnt+l]->SetValue(sqrt(G[0]*G[0]+G[1]*G[1])
00157                                                    ,i,j);
00158                     mGradAng[o*mLevelCnt+l]->SetValue(atan(G[1]/G[0]),i,j);
00159 
00160 
00161                 }
00162                 }
00163                 /*
00164                 ILOG_DEBUG("Octave("<<o<<","<<l<<") : ("
00165                             <<PixMin( mGradMag[o*mLevels+l]) <<","
00166                             <<PixMax( mGradMag[o*mLevels+l]) <<") ("
00167                             <<PixMin( mGradAng[o*mLevels+l]) <<","
00168                             <<PixMax( mGradAng[o*mLevels+l]) <<")");*/
00169                 Normalize(mGradMag[o*mLevelCnt+l]);
00170 
00171             }
00172         }
00173     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:20:10 2011 for ImpalaSrc by  doxygen 1.5.1