File Exchange

image thumbnail

SIFT feature computation

version 1.0.0.0 (833 KB) by I Chieh Chen
An testing version of SIFT feature detection and calculation

36 Downloads

Updated 10 Apr 2014

View License

Each block of the code corresponds to a part of the SIFT feature algorithm by the original paper : http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf
and the sketch note: http://people.csail.mit.edu/hasinoff/320/sift-notes.txt
I'm trying my best to do exactly the same as the original paper does, but the results are not perfect (or can be a few bugs or miscalculations there).
Please be free using my code, and I will be appreciated if bugs or miscalculations found and replied :)

Cite As

I Chieh Chen (2020). SIFT feature computation (https://www.mathworks.com/matlabcentral/fileexchange/46184-sift-feature-computation), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (21)

binzhao xu

hi, your code is very good. But I think there may some mistake
1. the Gaussian convolution
for s = 1:StackNum
SigmaScale = Sigma * ScaleFactor^(s-2);
this should be s-1, using first octave and first sample to verify
2. the accurate keypoint localization

For those still wondering why the key points are of size 128*36, this is because when you compute the main orientation of a key point using orientation histogram, you create a new key point for every sub orientation whose value is >= 0.8 of the main orientation. As we use 36 bins (10 degrees per bin), the extra 36 element correspond to additional key points generated with this. You can just reshape the array in a smart way to create features with 128 values.

chit saint

What is @times
Please explain to me!

Jipnd

xxxx

how to run this file?

pa bl

Hello I am new in matlab.
I wanted torun the file and got this error:
Out of memory. Type HELP MEMORY for your options.
Error in SiftMain (line 44)
CompareDiffImg =zeros(size(OctaveImage{Octave,1},1)-2,size(OctaveImage{Octave,1},2)-2,27);
Does anybody know why?

anmol gupta

The size of extracted feature descriptor is N*128*36, where N is no. of keypoints. What does 36 mean here and how to eliminate this factor so that we can get descriptor vector of size N*128 only?

Pierre

Finally I have found the reason for the value 14. As you remember, extremums at the scale s are determinated with the adjacent scales (s-1) and (s+1) and a [3x3]neighbourhood . That means that at the beginning of the image the pixel index
are the following (index of the point Under test = 14 !):
s-1 | s | s+1
1 2 3 | 4 5 6 | 7 8 9
10 11 12 | 13 14 15 | ......

Pierre

Thank you for this very interesting code.
nevertheless can anybody explain me where does the value 14 come from.
MinMap = (MinMap == 14);
[~,MaxMap] = max(CompareDiffImg,[],3);
MaxMap = (MaxMap == 14);

Thank you for your help

Howie

Heni Endah

Thankyou sir. Nice Code.

[~,MinMap] = min(CompareDiffImg,[],3);
MinMap = (MinMap == 14);
[~,MaxMap] = max(CompareDiffImg,[],3);
MaxMap = (MaxMap == 14);
DiffMinMaxMap{Octave,s-1} = MinMap + MaxMap; % the center indx is 9 + 5 = 14

But, where did we get 14? anyone can help me?

Good one

anu

Hello Sir,This is good code.but i am not getting right result.Have you got mistake?

sindhu

Hi,Really great code!I'm working on a project which uses SIFT. Could you please tell me how to display images from the cell array? Looking forward for your reply.
Thank you.

yuli zhang

well done

jaydeep

nice code
please provide more information on code
how it is implement? each variable is for what purpose?

I Chieh Chen

Hi hamed, thanks for the response.
For feature matching, there's a general way: RANSAC algorithm
see: http://en.wikipedia.org/wiki/RANSAC
and please search: RANSAC SIFT, you may find useful information.
If you need more detailed information, you're welcome to discuss with me.
PS. plz be reminded that my code is not for sure the correct way for feature computation.
The website created by the author or the original paper: http://www.cs.ubc.ca/~lowe/keypoints/
offers the code for feature detection and feature matching, thanks!

hamed

hi, thanks for your great code. can you please tell me how can I match these created key points?

hamed

Hossein

that is cool

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

SIFT_V1/