rmislam/PythonSIFT

Mistake when calucalate the magnitude and orientation of keypoints' neighbourhoods.

Closed this issue · 1 comments

Keypoints' neigbbourhoods need to be in the Gaussian scaled image but not the original image.

for example in your code:

for i in range(0, 3):  
    for j in range(1, doubled.shape[0] - 1):   
           for k in range(1, doubled.shape[1] - 1):   
                magpyrlvl1[j, k, i] = ( ((doubled[j+1, k] - doubled[j-1, k]) ** 2) + ((doubled[j, k+1] - doubled[j, k-1]) ** 2) ) ** 0.5 
                oripyrlvl1[j, k, i] = (36 / (2 * np.pi)) * (np.pi + np.arctan2((doubled[j, k+1] - doubled[j, k-1]), (doubled[j+1, k] - doubled[j-1, k]))) 

The doubled[j,k,i] maybe should be replaced by pyrlvl1[j,k,i+1].

Thanks for looking over my code. I've made a major update, and the performance is much better now. I believe the issue you have here is resolved in the lastest commits. Feel free to open another PR if you see other issues.