Class FastHessianFeatureDetector<II extends ImageGray<II>>

java.lang.Object
boofcv.alg.feature.detect.interest.FastHessianFeatureDetector<II>

public class FastHessianFeatureDetector<II extends ImageGray<II>> extends Object

The Fast Hessian (FH) [1] interest point detector is designed to be a fast multi-scale "blob" detector. FH is intended for use as a feature detector for SURF [1]. It works by computing an approximation of the image Hessian's determinant using "box-lets" type features. Unlike traditional scale-space algorithms the feature itself is rescaled and is efficiently computed using an integral image.

This class is intended to be a faithful implementation of the algorithm described in [1]. Deviations from that paper are noted in the code an in the comments below. This detector can be used to implement the FH-9 and FH-15 detectors. For the FH-15 detector the input image needs to be doubled in size prior to processing and the feature location rescaled.

Description of scale space approach, see [1] for a more detailed and complete description. Features are detected in a series of octaves. Each octave is defined as a set of scales where higher octaves contain larger scales. A scale is defined by a feature's size in pixels, the size is the feature's width/height. Improved accuracy in done by interpolating feature location in pixel coordinates and scale.

For example, the FH-9 detector has 4 octaves with the following detector sizes:
Octave 1: Sizes = 9,15,21,27
Octave 2: Sizes = 15,27,39,51
Octave 3: Sizes = 27,51,75,99
Octave 4: Sizes = 51,99,147,195

Features are only detected for sizes which have a size smaller and larger. For the first octave in the example above that would be for sizes 15 and 21. Sizes 9 and 27 are only used to identify local maximums in scale space.

Laplacian sign is used to decide if a point is white or not. This can be used to split detected points into two sets.

Note: Interpolation is performed by fitting a second order polynomial instead of a quadratic, as suggested in the paper. See comments in polyPeak(float, float, float).

[1] Herbert Bay, Andreas Ess, Tinne Tuytelaars, and Luc Van Gool, "Speeded-Up Robust Features (SURF)", CVIU June, 2008, Volume 110, Issue 3, pages 346-359

See Also:
  • Field Details

    • maxFeaturesPerScale

      public int maxFeaturesPerScale
      the maximum number of returned feature per scale. If <= 0 then all are returned.
    • maxFeaturesAll

      public int maxFeaturesAll
      Maximum number of features after combining results across all scales. if <= 0 then all are returned
    • kerXX

      protected IntegralKernel kerXX
    • kerYY

      protected IntegralKernel kerYY
    • hessXX

      protected IntegralKernel hessXX
    • hessYY

      protected IntegralKernel hessYY
    • hessXY

      protected IntegralKernel hessXY
    • inten0

      protected ImageBorder_F32 inten0
    • inten2

      protected ImageBorder_F32 inten2
  • Constructor Details

    • FastHessianFeatureDetector

      public FastHessianFeatureDetector(NonMaxSuppression extractor, FeatureSelectLimitIntensity<Point2D_I16> selectFeaturesInScale, FeatureSelectLimitIntensity<ScalePoint> selectFeaturesAll, int initialSampleRate, int initialSize, int numberScalesPerOctave, int numberOfOctaves, int scaleStepSize)

      Defines the feature detector by specifying the size of features.

      Configuration for FH-9: initialSampleSize=1, initialSize=9, numberScalesPerOctave=4, numberOfOctaves=4
      Configuration for FH-15: initialSampleSize=1, initialSize=15, numberScalesPerOctave=5, numberOfOctaves=4
      * Note that FH-15 requires the image to be up sampled first. See [1] for details.

      Parameters:
      extractor - Feature extractor used to find local maximums in 2D image.
      selectFeaturesInScale - How to prune excessive features inside a single scale
      selectFeaturesAll - How to prune excessive features after combining all scales
      initialSampleRate - How often pixels are sampled in the first octave.
      initialSize - Size/width of the smallest feature/kernel in the lowest octave.
      numberScalesPerOctave - How many different feature sizes are considered in a single octave
      numberOfOctaves - How many different octaves are considered.
      scaleStepSize - Increment between kernel sizes as it goes up in scale. Try 6
  • Method Details

    • detect

      public void detect(II integral)
      Detect interest points inside of the image.
      Parameters:
      integral - Image transformed into an integral image.
    • detectOctave

      protected void detectOctave(II integral, int skip, int... featureSize)
      Computes feature intensities for all the specified feature sizes and finds features inside of the middle feature sizes.
      Parameters:
      integral - Integral image.
      skip - Pixel skip factor
      featureSize - which feature sizes should be detected.
    • computeLaplaceSign

      public boolean computeLaplaceSign(int x, int y, double scale)
      Compute the sign of the Laplacian using a sparse convolution.
      Parameters:
      x - center
      y - center
      scale - scale of the feature
      Returns:
      true if positive
    • checkMax

      protected static boolean checkMax(ImageBorder_F32 inten, float bestScore, int c_x, int c_y)
      Sees if the best score in the current layer is greater than all the scores in a 3x3 neighborhood in another layer.
    • polyPeak

      public static float polyPeak(float lower, float middle, float upper)

      Fits a second order polynomial to the data and determines the location of the peak.
      y = a*x2+b*x + c
      x = {-1,0,1}
      y = Feature value

      Note: The original paper fit a 3D Quadratic to the data instead. This required the first and second derivative of the Laplacian to be estimated. Such estimates are error prone and using the technique found in OpenSURF produced erratic results and required some hackery to get to work. This should always produce stable results and is much faster.

      Parameters:
      lower - Value at x=-1
      middle - Value at x=0
      upper - Value at x=1
      Returns:
      x-coordinate of the peak
    • polyPeak

      public static double polyPeak(double lower, double middle, double upper)
    • polyPeak

      public static double polyPeak(double lower, double middle, double upper, double lowerVal, double middleVal, double upperVal)
    • getFoundFeatures

      public List<ScalePoint> getFoundFeatures()
      Returns all the found interest points.
      Returns:
      Found interest points.
    • getSmallestWidth

      public int getSmallestWidth()
      Returns the width of the smallest feature it can detect