SIFT feature matching through Euclidean distance
SIFT feature matching is done through a Euclidean-distance based nearest neighbor approach. Can som开发者_如何学Goe please explain this? Is there a calculation? If then can someone help me to calculate the Euclidean distance for my SIFT feature vector? I want to save calculated Euclidean distances to feed for neural network with some more features like roundness and color of images.
SIFT feature matching through Euclidean distance is not a difficult task. The process can be explained as follows:
Extract the SIFT keypoint descriptors for both images.
Take one keypoint descriptor (reference descriptor) from one image.
2.1 Now, find the Euclidean distances between the reference descriptor and all keypoint descriptors of the other image.
2.2 Consequently, you have the Euclidean distances from the reference descriptor to all the keypoint descriptors in image2. Arrange them in ascending order.(It implies the nearest distances for keypoint in image1 to keypoints in image2)
2.3 Now, set some threshold T ( mostly in the range of 0.3 to 0.7).
2.4 Take the ratio of the first nearest distance to the second nearest distance and if it is below the threshold T, then it is a match and, therefore, you save that index. Otherwise, there is no match.
Repeat this for all keypoint descriptors in image1.
- Now you have the matches. You can plot the matches by appending the two images and then based on keypoint locations.
I think your doubt is what the euclidean distance is. The euclidean distance is the distance between two points as seen in a Euclidean (or 2 dimensional) plane. It is very visual fo a two dimensional plane, but as SIFT descriptors are vectors of 128 dimension it gets tricky. You just have to stick to the formula (https://en.wikipedia.org/wiki/Euclidean_distance)
This is my code for calculating the euclidean distance:
for j = 1 : length(SIFT2)
euclideanDist(j) = sqrt(sum((SIFT1{i} - SIFT2{j}).^2));
end
The code will find the distance from point 'i' on the first image to all of the encountered points in the 2nd image, 'j' in this case. I store this distances in the vector euclideanDist.
The cell-arrays SIFT1 and SIFT2 contain the descriptors of each image.
精彩评论