How can the following work?
I am seeking for MSER
feature points and then pairing them with matchFeatures
function.
% file1 = 'roofs1.jpg';
% file2 = 'roofs2.jpg';
file1 = 'cameraman.tif';
I1 = imread(file1);
%I2 = imread(file2);
I2 = imrotate(I1, 45);
% I1 = rgb2gray(I1);
% I2 = rgb2gray(I2);
% %Find the SURF features.
% points1 = detectSURFFeatures(I1);
% points2 = detectSURFFeatures(I2);
points1 = detectMSERFeatures(I1);
points2 = detectMSERFeatures(I2);
%Extract the features.
[f1, vpts1] = extractFeatures(I1, points1);
[f2, vpts2] = extractFeatures(I2, points2);
%Retrieve the locations of matched points. The SURF featurevectors are already normalized.
indexPairs = matchFeatures(f1, f2, 'Prenormalized', true) ;
matched_pts1 = vpts1(indexPairs(:, 1));
matched_pts2 = vpts2(indexPairs(:, 2));
figure; showMatchedFeatures(I1,I2,matched_pts1,matched_pts2,'montage');
legend('matched points 1','matched points 2');
Apparently it works fine
But how it can be? MSERRegions
contains only ellipses. How can they paired? It is apparently not enough information!
UPDATE
I found that extractFeatures
function returns SURF feature vectors from MSER points. So it compares 64-dimensional SURF vectors.
In this case the centroids of the MSER regions are simply used as interest points for extracting SURF descriptors. By default if you pass MSERRegions
into extractFeatures
you will get SURF descriptors back. However, MSER regions can be used for other things, such as detecting text in images.