Class DescribePointSift<Deriv extends ImageGray<Deriv>>
A faithful implementation of the SIFT descriptor.
The descriptor is computed inside of a square grid which is scaled and rotated. Each grid cell is composed of a square sub-region. If the sub-region is 4x4 and the outer grid is 5x5 then a total area of size 20x20 is sampled. For each sub-region a histogram with N bins of orientations is computed. Orientation from each sample point comes from the image's spacial derivative. If the outer grid is 4x4 and the histogram N=8, then the total descriptor will be 128 elements.
When a point is sample, its orientation (-pi to pi) and magnitude sqrt(dx**2 + dy**2) are both computed. A contribution from this sample point is added to the entire descriptor and weighted using trilinear interpolation (outer grid x-y coordinate, and orientation bin), Gaussian distribution centered at key point location, and the magnitude.
There are no intentional differences from the paper. However the paper is ambiguous in some places.
- Interpolation method for sampling image pixels isn't specified. Nearest-neighbor is assumed and that's what VLFeat uses too.
- Size of sample region. Oddly enough, I can't find this very important parameter specified anywhere. The suggested value comes from empirical testing.
[1] Lowe, D. "Distinctive image features from scale-invariant keypoints". International Journal of Computer Vision, 60, 2 (2004), pp.91--110.
-
Field Summary
Fields inherited from class boofcv.alg.feature.describe.DescribeSiftCommon
gaussianWeight, histogramBinWidth, maxDescriptorElementValue, numHistogramBins, widthGrid, widthSubregion
-
Constructor Summary
ConstructorDescriptionDescribePointSift
(int widthSubregion, int widthGrid, int numHistogramBins, double sigmaToPixels, double weightingSigmaFraction, double maxDescriptorElementValue, Class<Deriv> derivType) Configures the descriptor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
process
(double c_x, double c_y, double sigma, double orientation, TupleDesc_F64 descriptor) Computes the SIFT descriptor for the specified key pointvoid
setImageGradient
(Deriv derivX, Deriv derivY) Sets the image spacial derivatives.Methods inherited from class boofcv.alg.feature.describe.DescribeSiftCommon
createGaussianWeightKernel, getCanonicalRadius, getDescriptorLength, normalizeDescriptor, trilinearInterpolation
-
Constructor Details
-
DescribePointSift
public DescribePointSift(int widthSubregion, int widthGrid, int numHistogramBins, double sigmaToPixels, double weightingSigmaFraction, double maxDescriptorElementValue, Class<Deriv> derivType) Configures the descriptor.- Parameters:
widthSubregion
- Width of sub-region in samples. Try 4widthGrid
- Width of grid in subregions. Try 4.numHistogramBins
- Number of bins in histogram. Try 8sigmaToPixels
- Conversion of sigma to pixels. Used to scale the descriptor region. Try 1.5 ??????weightingSigmaFraction
- Sigma for Gaussian weighting function is set to this value * region width. Try 0.5maxDescriptorElementValue
- Helps with non-affine changes in lighting. See paper. Try 0.2
-
-
Method Details
-
setImageGradient
Sets the image spacial derivatives. These should be computed from an image at the appropriate scale in scale-space.- Parameters:
derivX
- x-derivative of input imagederivY
- y-derivative of input image
-
process
public void process(double c_x, double c_y, double sigma, double orientation, TupleDesc_F64 descriptor) Computes the SIFT descriptor for the specified key point- Parameters:
c_x
- center of key point. x-axisc_y
- center of key point. y-axissigma
- Computed sigma in scale-space for this pointorientation
- Orientation of keypoint in radiansdescriptor
- (output) Storage for computed descriptor. Make sure it's the appropriate length first
-