示例#1
0
void buildResponseLayer(FastHessian *fh, ResponseLayer *rl)
{
	float *responses;				// response storage
	unsigned char *laplacian;		// laplacian sign storage
	int step;						// step size for this filter
	int b;							// border for this filter
	int l;							// lobe for this filter (filter size / 3)
	int w;							// filter size
	float inverse_area;				// normalisation factor
	float Dxx, Dyy, Dxy;
	int r, c, ar = 0, index = 0,ac;

	responses = rl->responses;
	laplacian = rl->laplacian;
	step = rl->step;
	b = (rl->filter - 1) / 2;
	l = rl->filter / 3;
	w = rl->filter;
	inverse_area = 1.f/(w*w);

	for(ar = 0; ar < rl->height; ++ar) 
		{
			for(ac = 0; ac < rl->width; ++ac, index++) 
				{
					// get the image coordinates
					r = ar * step;
					c = ac * step; 

					// Compute response components
				  Dxx = BoxIntegral(fh->img, r - l + 1, c - b, 2*l - 1, w)
					  - BoxIntegral(fh->img, r - l + 1, c - l / 2, 2*l - 1, l)*3;

				  Dyy = BoxIntegral(fh->img, r - b, c - l + 1, w, 2*l - 1)
					  - BoxIntegral(fh->img, r - l / 2, c - l + 1, l, 2*l - 1)*3;

				  Dxy = + BoxIntegral(fh->img, r - l, c + 1, l, l)
						+ BoxIntegral(fh->img, r + 1, c - l, l, l)
						- BoxIntegral(fh->img, r - l, c - l, l, l)
						- BoxIntegral(fh->img, r + 1, c + 1, l, l);

				  // Normalise the filter responses with respect to their size
				  Dxx *= inverse_area;
				  Dyy *= inverse_area;
				  Dxy *= inverse_area;

				  // Get the determinant of hessian response & laplacian sign
					responses[index] = (Dxx * Dyy - 0.81f * Dxy * Dxy);
					laplacian[index] = (Dxx + Dyy >= 0 ? 1 : 0);

				}
		}
}
示例#2
0
//! Calculate DoH responses for supplied layer
void FastHessian::buildResponseLayer(ResponseLayer *rl)
{
  float *responses = rl->responses;         // response storage
  unsigned char *laplacian = rl->laplacian; // laplacian sign storage
  int step = rl->step;                      // step size for this filter
  int b = (rl->filter - 1) / 2 + 1;         // border for this filter
  int l = rl->filter / 3;                   // lobe for this filter (filter size / 3)
  int w = rl->filter;                       // filter size
  float inverse_area = 1.f/(w*w);           // normalisation factor
  float Dxx, Dyy, Dxy;

  for(int r, c, ar = 0, index = 0; ar < rl->height; ++ar) 
  {
    for(int ac = 0; ac < rl->width; ++ac, index++) 
    {
      // get the image coordinates
      r = ar * step;
      c = ac * step; 

      // Compute response components
      Dxx = BoxIntegral(img, r - l + 1, c - b, 2*l - 1, w)
          - BoxIntegral(img, r - l + 1, c - l / 2, 2*l - 1, l)*3;
      Dyy = BoxIntegral(img, r - b, c - l + 1, w, 2*l - 1)
          - BoxIntegral(img, r - l / 2, c - l + 1, l, 2*l - 1)*3;
      Dxy = + BoxIntegral(img, r - l, c + 1, l, l)
            + BoxIntegral(img, r + 1, c - l, l, l)
            - BoxIntegral(img, r - l, c - l, l, l)
            - BoxIntegral(img, r + 1, c + 1, l, l);

      // Normalise the filter responses with respect to their size
      Dxx *= inverse_area;
      Dyy *= inverse_area;
      Dxy *= inverse_area;
     
      // Get the determinant of hessian response & laplacian sign
      responses[index] = (Dxx * Dyy - 0.81f * Dxy * Dxy);
      laplacian[index] = (Dxx + Dyy >= 0 ? 1 : 0);

#ifdef RL_DEBUG
      // create list of the image coords for each response
      rl->coords.push_back(std::make_pair<int,int>(r,c));
#endif
    }
  }
}
示例#3
0
//! Calculate Haar wavelet responses in y direction
inline float Surf::haarY(int row, int column, int s)
{
    return BoxIntegral(img, row, column-s/2, s/2, s)
           -1 * BoxIntegral(img, row-s/2, column-s/2, s/2, s);
}
示例#4
0
文件: surf.cpp 项目: Castlely/Surf
inline float SURF::haarX(int row, int column, int s)
{
  return BoxIntegral(img, row-s/2, column, s, s/2)
    -1 * BoxIntegral(img, row-s/2, column-s/2, s, s/2);
}