Class SiftDetector
Implementation of SIFT [1] feature detector. Feature detection is first done by creating the first octave in
a scale space
. Then the Difference-of-Gaussian (DoG) is computed from sequential
scales inside the scale-space. From the DoG images, pixels which are maximums and minimums spatially and with
in scale are found. Edges of objects can cause false positives so those are suppressed. The remaining
features are interpolated spatially and across scale.
This class is designed so that it can operate as a stand alone feature detector or so that it can be extended to compute feature descriptors too. The advantage of the former is that the scale-space only needs to be constructed once.
Processing Steps
- Construct first octave of DoG images using
SiftScaleSpace
- For DoG images 1 to N+1, detect features
- Use
NonMaxLimiter
to detect features spatially. - Check to see if detected features are minimums or maximums in DoG scale space by checking the equivalent 3x3
regions in the DoG images above and below it.
isScaleSpaceExtremum(int, int, float, float)
- Detect false positive edges using trace and determinant from Hessian of DoG image
- Interpolate feature's (x,y,sigma) coordinate using the peak of a 2nd order polynomial (quadratic).
createDetection(int, int, float, boolean)
Where N is the number of scale parameters. There are N+3 scale images and N+2 DoG images in an octave.
Edge Detection
Edges can also cause local extremes (false positives) in the DoG image. To remove those false positives an
edge detector is proposed by Lowe. The edge detector is turned with the parameter 'r' and a point is considered
an edge if the following is true:
Tr2/Det < (r+1)2/r
where Tr and Det are the trace an determinant of a 2x2 hessian matrix computed from the DoG hessian at that point,
[dXX,dXY;dYX,dYY]
Deviations from standard SIFT
- Spatial maximums are not limited to a 3x3 region like they are in the paper. User configurable.
- Quadratic interpolation is used independently on x,y, and scale axis.
- What the scale of a DoG image is isn't specified in the paper. Assumed to be the same as the lower indexed scale image it was computed from.
[1] Lowe, D. "Distinctive image features from scale-invariant keypoints". International Journal of Computer Vision, 60, 2 (2004), pp.91--110.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Adds information about the scale space it was detected in for quick reference when computing the descriptor -
Field Summary
Modifier and TypeFieldDescriptionprotected DogArray<SiftDetector.SiftPoint>
int
Maximum number of features after combining results across all scales. -
Constructor Summary
ConstructorDescriptionSiftDetector
(FeatureSelectLimitIntensity<ScalePoint> selectFeaturesAll, double edgeR, NonMaxLimiter extractor) Configures SIFT detector -
Method Summary
Modifier and TypeMethodDescriptionprotected SiftDetector.SiftPoint
createDetection
(int x, int y, float positiveIntensity, boolean maximum) Examines a local spatial extremum and interpolates its coordinates using a quadratic function.protected void
detectFeatures
(int octaveIndex, int scaleIndex) Detect features inside the Difference-of-Gaussian image at the current scaleAll the found and selected detections across scale spacevoid
process
(SiftScaleSpace scaleSpace) Detects SIFT features inside the input image
-
Field Details
-
maxFeaturesAll
public int maxFeaturesAllMaximum number of features after combining results across all scales. if <= 0 then all are returned -
detectionsAll
-
-
Constructor Details
-
SiftDetector
public SiftDetector(FeatureSelectLimitIntensity<ScalePoint> selectFeaturesAll, double edgeR, NonMaxLimiter extractor) Configures SIFT detector- Parameters:
edgeR
- Threshold used to remove edge responses. Larger values means its less strict. Try 10extractor
- Spatial feature detector that can be configured to limit the number of detected features in each scale.
-
-
Method Details
-
process
Detects SIFT features inside the input image- Parameters:
scaleSpace
- (Input) Precomputed scale space. Not modified.
-
detectFeatures
protected void detectFeatures(int octaveIndex, int scaleIndex) Detect features inside the Difference-of-Gaussian image at the current scale- Parameters:
scaleIndex
- Which scale in the octave is it detecting features inside up. Primarily provided here for use in child classes.
-
createDetection
protected SiftDetector.SiftPoint createDetection(int x, int y, float positiveIntensity, boolean maximum) Examines a local spatial extremum and interpolates its coordinates using a quadratic function. Very first thing it does is check to see if the feature is really an edge/false positive. After that interpolates the coordinate independently using a quadratic function along each axis. Resulting coordinate will be in the image image's coordinate system.- Parameters:
x
- x-coordinate of extremumy
- y-coordinate of extremumpositiveIntensity
- value of the extremum. Positive intensity value.maximum
- true if it was a maximum
-
getDetections
All the found and selected detections across scale space
-