- Matlab functions in the computer vision toolbox are optimized
- detectSURFFeatures should provider results similar to VLFEAT's VL_SIFT (it does the scale-invariant feature transform or SIFT)
I am using detectSURFFeatures to detect keypoints from medical images. I also use detectMinEigenFeatures and detectHarrisFeatures. I use extractFeatures to get features from the keypoints. I have used matchFeatures to find matches using the features. It isn't working well. I am getting suboptimal results from these functions in comparison to VLFEAT'S vl_sift function which provides keypoints and features and vl_ubcmatch which matches features. From VLFEAT, I get the results I want. I am wondering why this is happening. Is my usage of the functions incorrect (20 years experience with other toolboxes)? Are the functions not working? Is SIFT that much better than the other methods?
One of the difficulties with using VLFEAT is that it doesn't have the library of other computer vision toolbox functions that are in MATLAB. I'd like to use estimateEssentialMatrix and relativeCameraPose and bundleAdjustment. These are not functions available in VLFEAT. The keypoints and features have different data structures from each toolbox. It involves translating the toolbox data structures and filling in missing information with fake data.
This first figure shows SIFT in comparison with SURF. SIFT produces 647 keypoints. SURF produces 1. This is a distinct difference. I cannot do anything with 1 keypoint. You'll have to scroll to see the whole image.
>> points = detectSURFFeatures(d3(:,:,1));
SURFPoints with properties:
Location: [73.7826 327.8043]
scatter(points.Location(:,1), points.Location(:,2), 'rx')
detectHarrisFeatures does much better. It detects 443 keypoints and they are well-placed. I go with Harris instead of SURF. This next figure shows SIFT and Harris compared.
>> points = detectHarrisFeatures(d3(:,:,1));
443×1 cornerPoints array with properties:
Location: [443×2 single]
Metric: [443×1 single]
I extract the features with extractFeatures, and I match the features with matchFeatures. The two images are so close to each other (slight left-right movement) that it should find matches that are a small amount of pixels apart. These two functions find what looks like matches between the top of the head and the bottom of the head which are false.
>> features1 = extractFeatures(d3(:,:,1), points1);
>> features2 = extractFeatures(d3(:,:,2), points2);
>> [idxPairs, matchMetric] = matchFeatures(features1, features2);
>> mp1 = points1(idxPairs(:,1));
>> mp2 = points2(idxPairs(:,2));
>> showMatchedFeatures(d3(:,:,1), d3(:,:,2), mp1, mp2);
>> title('ShowMatchFeatures for Harris points')
VLSIFT does much better. Most matches are in close proximity, which is more correct.
>> [matches, scores] = vl_ubcmatch(d1, d2);
>> p1 = f1(1:2, matches(1,:));
>> p2 = f2(1:2, matches(2,:));
>> imshowpair(d3(:,:,1), d3(:,:,2));
>> hold on
>> scatter(p1(1,:), p1(2,:), 'g+');
>> scatter(p2(1,:), p2(2,:), 'ro');
>> for k = 1:360
plot([p1(1,k) p2(1,k)], [p1(2,k) p2(2,k)], 'y');
>> title('Show matches for SIFT points')
It seems like the matlab toolbox functions are suboptimal. However, I may be doing something wrong. If you find an error, please let me know. If you don't find an error, it begs the question: What is going on?
I appreciate your feedback.