public class SiftDetector extends Object
Implementation of SIFT  feature detector. Feature detection is first done by creating the first octave in
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.
- Construct first octave of DoG images using
- For DoG images 1 to N+1, detect features
NonMaxLimiterto 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.
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.
 Lowe, D. "Distinctive image features from scale-invariant keypoints". International Journal of Computer Vision, 60, 2 (2004), pp.91--110.
Nested Class Summary
Nested Classes Modifier and Type Class Description
static classAdds information about the scale space it was detected in for quick reference when computing the descriptor
Modifier and Type Method Description
(int x, int y, float positiveIntensity, boolean maximum)Examines a local spatial extremum and interpolates its coordinates using a quadratic function.
(int octaveIndex, int scaleIndex)Detect features inside the Difference-of-Gaussian image at the current scale
()All the found and selected detections across scale space
SiftScaleSpace scaleSpace)(Detects SIFT features inside the input image
maxFeaturesAllpublic int maxFeaturesAllMaximum number of features after combining results across all scales. if <= 0 then all are returned
SiftDetectorpublic SiftDetector(FeatureSelectLimitIntensity<ScalePoint> selectFeaturesAll, double edgeR, NonMaxLimiter extractor)Configures SIFT detector
edgeR- Threshold used to remove edge responses. Larger values means its less strict. Try 10
extractor- Spatial feature detector that can be configured to limit the number of detected features in each scale.
processpublic void process(SiftScaleSpace scaleSpace)Detects SIFT features inside the input image
scaleSpace- (Input) Precomputed scale space. Not modified.
detectFeaturesprotected void detectFeatures(int octaveIndex, int scaleIndex)Detect features inside the Difference-of-Gaussian image at the current scale
scaleIndex- Which scale in the octave is it detecting features inside up. Primarily provided here for use in child classes.
createDetectionprotected 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.
x- x-coordinate of extremum
y- y-coordinate of extremum
positiveIntensity- value of the extremum. Positive intensity value.
maximum- true if it was a maximum
getDetectionsAll the found and selected detections across scale space