3rdparty/OpenCV-2.3.0/modules/features2d/src/sift.cpp
static CvMat* deriv_3D( IplImage*** dog_pyr, int octv, int intvl, int r, int c )
{
  CvMat* dI;
  double dx, dy, ds;

  dx = ( pixval32f( dog_pyr[octv][intvl], r, c+1 ) -
         pixval32f( dog_pyr[octv][intvl], r, c-1 ) ) / 2.0;
  dy = ( pixval32f( dog_pyr[octv][intvl], r+1, c ) -
         pixval32f( dog_pyr[octv][intvl], r-1, c ) ) / 2.0;
  ds = ( pixval32f( dog_pyr[octv][intvl+1], r, c ) -
         pixval32f( dog_pyr[octv][intvl-1], r, c ) ) / 2.0;

  dI = cvCreateMat( 3, 1, CV_64FC1 );
  cvmSet( dI, 0, 0, dx );
  cvmSet( dI, 1, 0, dy );
  cvmSet( dI, 2, 0, ds );

  return dI;
}
/*
  Computes the partial derivatives in x, y, and scale of a pixel in the DoG
  scale space pyramid.

  @param dog_pyr DoG scale space pyramid
  @param octv pixel's octave in dog_pyr
  @param intvl pixel's interval in octv
  @param r pixel's image row
  @param c pixel's image col

  @return Returns the vector of partial derivatives for pixel I
    { dI/dx, dI/dy, dI/ds }^T as a CvMat*
*/
Computes the partial derivatives in x, y, and scale of a pixel in the DoG
scale space pyramid.
Computes the partial derivatives in x y and scale of a pixel in the DoG scale space pyramid .
static CvMat* deriv_3D( IplImage*** dog_pyr, int octv, int intvl, int r, int c )
{
  CvMat* dI;
  double dx, dy, ds;
  dx = ( pixval32f( dog_pyr[octv][intvl], r, c+1 ) -
         pixval32f( dog_pyr[octv][intvl], r, c-1 ) ) / 2.0;
  dy = ( pixval32f( dog_pyr[octv][intvl], r+1, c ) -
         pixval32f( dog_pyr[octv][intvl], r-1, c ) ) / 2.0;
  ds = ( pixval32f( dog_pyr[octv][intvl+1], r, c ) -
         pixval32f( dog_pyr[octv][intvl-1], r, c ) ) / 2.0;
  dI = cvCreateMat( 3, 1, CV_64FC1 );
  cvmSet( dI, 0, 0, dx );
  cvmSet( dI, 1, 0, dy );
  cvmSet( dI, 2, 0, ds );
  return dI;
}
static CvMat * deriv_3D ( IplImage * * * dog_pyr , int octv , int intvl , int r , int c ) { CvMat * dI ; double dx , dy , ds ; dx = ( pixval32f ( dog_pyr [ octv ] [ intvl ] , r , c + 1 ) - pixval32f ( dog_pyr [ octv ] [ intvl ] , r , c - 1 ) ) / 2.0 ; dy = ( pixval32f ( dog_pyr [ octv ] [ intvl ] , r + 1 , c ) - pixval32f ( dog_pyr [ octv ] [ intvl ] , r - 1 , c ) ) / 2.0 ; ds = ( pixval32f ( dog_pyr [ octv ] [ intvl + 1 ] , r , c ) - pixval32f ( dog_pyr [ octv ] [ intvl - 1 ] , r , c ) ) / 2.0 ; dI = cvCreateMat ( 3 , 1 , CV_64FC1 ) ; cvmSet ( dI , 0 , 0 , dx ) ; cvmSet ( dI , 1 , 0 , dy ) ; cvmSet ( dI , 2 , 0 , ds ) ; return dI ; }
Computes the partial derivatives in x, y, and scale of a pixel in the DoG
scale space pyramid.
Computes the partial derivatives in x y and scale of a pixel in the DoG scale space pyramid .