3rdparty/OpenCV-2.3.0/modules/features2d/src/sift.cpp
static CvSeq* scale_space_extrema( IplImage*** dog_pyr, int octvs, int intvls,
                                   double contr_thr, int curv_thr,
                                   CvMemStorage* storage )
{
  CvSeq* features;
  double prelim_contr_thr = 0.5 * contr_thr / intvls;
  struct feature* feat;
  struct detection_data* ddata;
  int o, i, r, c;

  features = cvCreateSeq( 0, sizeof(CvSeq), sizeof(struct feature), storage );
  for( o = 0; o < octvs; o++ )
    for( i = 1; i <= intvls; i++ )
      for(r = SIFT_IMG_BORDER; r < dog_pyr[o][0]->height-SIFT_IMG_BORDER; r++)
        for(c = SIFT_IMG_BORDER; c < dog_pyr[o][0]->width-SIFT_IMG_BORDER; c++)
          /* perform preliminary check on contrast */
          if( std::abs( pixval32f( dog_pyr[o][i], r, c ) ) > prelim_contr_thr )
            if( is_extremum( dog_pyr, o, i, r, c ) )
              {
                feat = interp_extremum(dog_pyr, o, i, r, c, intvls, contr_thr);
                if( feat )
                  {
                    ddata = feat->feature_data;
                    if( ! is_too_edge_like( dog_pyr[ddata->octv][ddata->intvl],
                                            ddata->r, ddata->c, curv_thr ) )
                      {
                        cvSeqPush( features, feat );
                      }
                    else
                      free( ddata );
                    free( feat );
                  }
              }

  return features;
}
/*
  Detects features at extrema in DoG scale space.  Bad features are discarded
  based on contrast and ratio of principal curvatures.

  @param dog_pyr DoG scale space pyramid
  @param octvs octaves of scale space represented by dog_pyr
  @param intvls intervals per octave
  @param contr_thr low threshold on feature contrast
  @param curv_thr high threshold on feature ratio of principal curvatures
  @param storage memory storage in which to store detected features

  @return Returns an array of detected features whose scales, orientations,
    and descriptors are yet to be determined.
*/
Detects features at extrema in DoG scale space.  Bad features are discarded
based on contrast and ratio of principal curvatures.
Detects features at extrema in DoG scale space . Bad features are discarded based on contrast and ratio of principal curvatures .
static CvSeq* scale_space_extrema( IplImage*** dog_pyr, int octvs, int intvls,
                                   double contr_thr, int curv_thr,
                                   CvMemStorage* storage )
{
  CvSeq* features;
  double prelim_contr_thr = 0.5 * contr_thr / intvls;
  struct feature* feat;
  struct detection_data* ddata;
  int o, i, r, c;
  features = cvCreateSeq( 0, sizeof(CvSeq), sizeof(struct feature), storage );
  for( o = 0; o < octvs; o++ )
    for( i = 1; i <= intvls; i++ )
      for(r = SIFT_IMG_BORDER; r < dog_pyr[o][0]->height-SIFT_IMG_BORDER; r++)
        for(c = SIFT_IMG_BORDER; c < dog_pyr[o][0]->width-SIFT_IMG_BORDER; c++)
          if( std::abs( pixval32f( dog_pyr[o][i], r, c ) ) > prelim_contr_thr )
            if( is_extremum( dog_pyr, o, i, r, c ) )
              {
                feat = interp_extremum(dog_pyr, o, i, r, c, intvls, contr_thr);
                if( feat )
                  {
                    ddata = feat->feature_data;
                    if( ! is_too_edge_like( dog_pyr[ddata->octv][ddata->intvl],
                                            ddata->r, ddata->c, curv_thr ) )
                      {
                        cvSeqPush( features, feat );
                      }
                    else
                      free( ddata );
                    free( feat );
                  }
              }
  return features;
}
static CvSeq * scale_space_extrema ( IplImage * * * dog_pyr , int octvs , int intvls , double contr_thr , int curv_thr , CvMemStorage * storage ) { CvSeq * features ; double prelim_contr_thr = 0.5 * contr_thr / intvls ; struct feature * feat ; struct detection_data * ddata ; int o , i , r , c ; features = cvCreateSeq ( 0 , sizeof ( CvSeq ) , sizeof ( struct feature ) , storage ) ; for ( o = 0 ; o < octvs ; o ++ ) for ( i = 1 ; i <= intvls ; i ++ ) for ( r = SIFT_IMG_BORDER ; r < dog_pyr [ o ] [ 0 ] -> height - SIFT_IMG_BORDER ; r ++ ) for ( c = SIFT_IMG_BORDER ; c < dog_pyr [ o ] [ 0 ] -> width - SIFT_IMG_BORDER ; c ++ ) if ( std :: abs ( pixval32f ( dog_pyr [ o ] [ i ] , r , c ) ) > prelim_contr_thr ) if ( is_extremum ( dog_pyr , o , i , r , c ) ) { feat = interp_extremum ( dog_pyr , o , i , r , c , intvls , contr_thr ) ; if ( feat ) { ddata = feat -> feature_data ; if ( ! is_too_edge_like ( dog_pyr [ ddata -> octv ] [ ddata -> intvl ] , ddata -> r , ddata -> c , curv_thr ) ) { cvSeqPush ( features , feat ) ; } else free ( ddata ) ; free ( feat ) ; } } return features ; }
Detects features at extrema in DoG scale space.
Detects features at extrema in DoG scale space .
/* perform preliminary check on contrast */