public class FastHessianFeatureDetector<II extends boofcv.struct.image.ImageGray>
extends java.lang.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.
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
FactoryInterestPoint| Constructor and Description |
|---|
FastHessianFeatureDetector(NonMaxSuppression extractor,
int maxFeaturesPerScale,
int initialSampleRate,
int initialSize,
int numberScalesPerOctave,
int numberOfOctaves,
int scaleStepSize)
Defines the feature detector by specifying the size of features.
|
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
checkMax(boofcv.core.image.border.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.
|
void |
detect(II integral)
Detect interest points inside of the image.
|
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.
|
java.util.List<ScalePoint> |
getFoundPoints()
Returns all the found interest points.
|
int |
getSmallestWidth()
Returns the width of the smallest feature it can detect
|
static double |
polyPeak(double lower,
double middle,
double upper) |
static double |
polyPeak(double lower,
double middle,
double upper,
double lowerVal,
double middleVal,
double upperVal) |
static float |
polyPeak(float lower,
float middle,
float upper)
Fits a second order polynomial to the data and determines the location of the peak.
|
public FastHessianFeatureDetector(NonMaxSuppression extractor, int maxFeaturesPerScale, 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.
extractor - Feature extractor used to find local maximums in 2D image.maxFeaturesPerScale - Maximum number of features it can find per image scale. If set ≤ 0 then the all potential
features will be returned, which is how it is in the original paper.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 octavenumberOfOctaves - How many different octaves are considered.scaleStepSize - Increment between kernel sizes as it goes up in scale. Try 6public void detect(II integral)
integral - Image transformed into an integral image.protected void detectOctave(II integral, int skip, int... featureSize)
integral - Integral image.skip - Pixel skip factorfeatureSize - which feature sizes should be detected.protected static boolean checkMax(boofcv.core.image.border.ImageBorder_F32 inten,
float bestScore,
int c_x,
int c_y)
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.
lower - Value at x=-1middle - Value at x=0upper - Value at x=1public static double polyPeak(double lower,
double middle,
double upper)
public static double polyPeak(double lower,
double middle,
double upper,
double lowerVal,
double middleVal,
double upperVal)
public java.util.List<ScalePoint> getFoundPoints()
public int getSmallestWidth()