Distinctive Image Features from Scale-Invariant Keypoints: Difference between revisions

 
(One intermediate revision by the same user not shown)
Line 35: Line 35:
===Keypoint localization===
===Keypoint localization===
===Orientation assignment===
===Orientation assignment===
* For every keypoint, take a patch around the keypoint and compute a gradient (norm, angle) for each pixel in the patch.
* Build a histogram of gradients, binned along angles. Smooth this histogram by fitting a parabola to 3 values closest to each peak.
* The peak of the histogram is the ''dominant orientation''
===Keypoint descriptor===
===Keypoint descriptor===
# First we do normalization:
#* Rotate the window to standard orientation (orientation up)
#* Scaled window size
# For an 16x16 patch around the keypoint, compute gradients (direction, norm) and weight by gaussian distance to the center.
# Split the 16x16 patch to 4x4 patches (each of 4x4 pixels) and generate a histogram (8-dim vector) for each patch. In total, you will have 16 histograms, each a 8-dim vector for a total of 128. Concatenate these to a 128-dim feature vector.
# Normalize the feature vector to unit length.
;Notes
* SIFT is hard to implement due to all the details. Always use a library.
* The smoothness from Gaussian weighting is important so that the descriptor doesn't change too much if the location of the keypoint isn't exactly the same between images.
* Gradient magnitudes are clipped so the histogram doesn't overweigh a single gradient.
* Normalization to 1 is important for being robust to illumination change.