Esempio n. 1
0
void FastHessian::compute()
{
  // For each octave, only the filter sizes not already used for
  // smaller scales are added. This means that the (up to) four
  // interval layers for each octave will be at different points of
  // the response map. This mapping gives those indexes, corresponding
  // to the buildup in buildResponseMap().
  //
  // (Taken from the openSURF code).
  static const int filter_map [OCTAVES][INTERVALS] = {{0,1,2,3},
                                                      {1,3,4,5},
                                                      {3,5,6,7},
                                                      {5,7,8,9},
                                                      {7,9,10,11}};

  // start by clearing out any existing interest points and building
  // the Hessian response map.
  m_ipoints.clear();
  buildResponseMap();

  // Compute maxima by comparing points to the level above and below
  // them. The SURF article is quite vague on whether or not
  // comparison is made between different octaves. The SIFT article
  // does not mention this either. However, the opencv and the
  // opensurf implementations seem to agree that comparison is only
  // done within octaves, so this is the approach we take here.

  ResponseLayer *b,*m,*t;
  int o,i,x,y;

  // Loop through all octaves, and for octave, select m_interval-2
  // sets of top/middle/bottom. This does in practice mean that only 3
  // or 4 intervals pr octave make sense.
  for(o = 0; o < m_octaves; o++) {
    for(i = 0; i < m_intervals-2; i++) {
      b = m_layers.at(filter_map[o][i]);
      m = m_layers.at(filter_map[o][i+1]);
      t = m_layers.at(filter_map[o][i+2]);

      // Loop at the scale of the top-most (most sparse) layer
      for(y = 0; y < t->height(); y++) {
        for(x = 0; x < t->width(); x++) {
          Point pt(x,y);
          if(maximal(pt, b, m, t)) addPoint(pt, b, m, t);
        }
      }
    }
  }
}
Esempio n. 2
0
int getIpoints(FastHessian *fh)
{
	int o,i,r,c;
	ResponseLayer *b, *m, *t;

	// filter index map // variables should be OCTAVES AND INTERVAL BUT THERE IS AN ERROR
	static const int filter_map [5][4] = {{0,1,2,3}, {1,3,4,5}, {3,5,6,7}, {5,7,8,9}, {7,9,10,11}};

	// Build the response map
	buildResponseMap(fh);

	// Get the response layers

	// Get the response layers
	
	 for (o = 0; o < fh->octaves; ++o)
	 {
		 for (i = 0; i <= 1; ++i)
		{
			b = &fh->responseMap[filter_map[o][i]];
			m = &fh->responseMap[filter_map[o][i+1]];
			t = &fh->responseMap[filter_map[o][i+2]];

		// loop over middle response layer at density of the most 
		// sparse layer (always top), to find maxima across scale and space
		for (r = 0; r < t->height; ++r)
		{
				for (c = 0; c < t->width; ++c)
				{
					if (isExtremum(r, c, t, m, b,fh))
					{
						interpolateExtremum(r, c, t, m, b,fh);
					}
				}
			}
	   }
	}
	return count;
}