Skip to content

Commit 6c62445

Browse files
committed
rearrange scale extraction expression from keypoint.size for consistency with keypoint.size computation (no change mathematically)
1 parent 8b1e28a commit 6c62445

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pysift.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def localizeExtremumViaQuadraticFit(i, j, image_index, octave_index, num_interva
178178
keypoint = KeyPoint()
179179
keypoint.pt = ((j + extremum_update[0]) * (2 ** octave_index), (i + extremum_update[1]) * (2 ** octave_index))
180180
keypoint.octave = octave_index + image_index * (2 ** 8) + int(round((extremum_update[2] + 0.5) * 255)) * (2 ** 16)
181-
keypoint.size = sigma * (2 ** ((image_index + extremum_update[2]) / float32(num_intervals))) * (2 ** (octave_index + 1))
181+
keypoint.size = sigma * (2 ** ((image_index + extremum_update[2]) / float32(num_intervals))) * (2 ** (octave_index + 1)) # octave_index + 1 because the input image was doubled
182182
keypoint.response = abs(functionValueAtUpdatedExtremum)
183183
return keypoint, image_index
184184
return None
@@ -224,7 +224,7 @@ def computeKeypointsWithOrientations(keypoint, octave_index, gaussian_image, rad
224224
keypoints_with_orientations = []
225225
image_shape = gaussian_image.shape
226226

227-
scale = scale_factor * 0.5 * keypoint.size / float32(2 ** octave_index)
227+
scale = scale_factor * keypoint.size / float32(2 ** (octave_index + 1)) # compare with keypoint.size computation in localizeExtremumViaQuadraticFit()
228228
radius = int(round(radius_factor * scale))
229229
weight_factor = -0.5 / (scale ** 2)
230230
raw_histogram = zeros(num_bins)

0 commit comments

Comments
 (0)