3rdparty/OpenCV-2.3.0/modules/features2d/src/sift.cpp
static void add_good_ori_features( CvSeq* features, double* hist, int n,
                                   double mag_thr, struct feature* feat )
{
  struct feature* new_feat;
  double bin, PI2 = CV_PI * 2.0;
  int l, r, i;

  for( i = 0; i < n; i++ )
    {
      l = ( i == 0 )? n - 1 : i-1;
      r = ( i + 1 ) % n;

      if( hist[i] > hist[l]  &&  hist[i] > hist[r]  &&  hist[i] >= mag_thr )
        {
          bin = i + interp_hist_peak( hist[l], hist[i], hist[r] );
          bin = ( bin < 0 )? n + bin : ( bin >= n )? bin - n : bin;
          new_feat = clone_feature( feat );
          new_feat->ori = ( ( PI2 * bin ) / n ) - CV_PI;
          cvSeqPush( features, new_feat );
          free( new_feat );
        }
    }
}
/*
  Adds features to an array for every orientation in a histogram greater than
  a specified threshold.

  @param features new features are added to the end of this array
  @param hist orientation histogram
  @param n number of bins in hist
  @param mag_thr new features are added for entries in hist greater than this
  @param feat new features are clones of this with different orientations
*/
Adds features to an array for every orientation in a histogram greater than
a specified threshold.
Adds features to an array for every orientation in a histogram greater than a specified threshold .
static void add_good_ori_features( CvSeq* features, double* hist, int n,
                                   double mag_thr, struct feature* feat )
{
  struct feature* new_feat;
  double bin, PI2 = CV_PI * 2.0;
  int l, r, i;
  for( i = 0; i < n; i++ )
    {
      l = ( i == 0 )? n - 1 : i-1;
      r = ( i + 1 ) % n;
      if( hist[i] > hist[l]  &&  hist[i] > hist[r]  &&  hist[i] >= mag_thr )
        {
          bin = i + interp_hist_peak( hist[l], hist[i], hist[r] );
          bin = ( bin < 0 )? n + bin : ( bin >= n )? bin - n : bin;
          new_feat = clone_feature( feat );
          new_feat->ori = ( ( PI2 * bin ) / n ) - CV_PI;
          cvSeqPush( features, new_feat );
          free( new_feat );
        }
    }
}
static void add_good_ori_features ( CvSeq * features , double * hist , int n , double mag_thr , struct feature * feat ) { struct feature * new_feat ; double bin , PI2 = CV_PI * 2.0 ; int l , r , i ; for ( i = 0 ; i < n ; i ++ ) { l = ( i == 0 ) ? n - 1 : i - 1 ; r = ( i + 1 ) % n ; if ( hist [ i ] > hist [ l ] && hist [ i ] > hist [ r ] && hist [ i ] >= mag_thr ) { bin = i + interp_hist_peak ( hist [ l ] , hist [ i ] , hist [ r ] ) ; bin = ( bin < 0 ) ? n + bin : ( bin >= n ) ? bin - n : bin ; new_feat = clone_feature ( feat ) ; new_feat -> ori = ( ( PI2 * bin ) / n ) - CV_PI ; cvSeqPush ( features , new_feat ) ; free ( new_feat ) ; } } }
Adds features to an array for every orientation in a histogram greater than
a specified threshold.
Adds features to an array for every orientation in a histogram greater than a specified threshold .