How to match a image with a folder of images using surf descriptor

1 次查看(过去 30 天)
I want to match a input image against a folder of images and display best match from the folder. I had used surf descriptor it works on two images i.e. it extracts the surf features from the images and match the extracted points. How to extract surf features from folder of images, I had tried with this [features(:,i),valid_points(:,i)] = extractFeatures(I1, points1);
but it gives an error "subscripted assignment dimension mismatch"
code is here....
srcFiles = dir('F:\MTECH\MATLAB\Begin\photos\*.jpg'); % the folder in which ur images exists for i = 1 : length(srcFiles) filename = strcat('F:\MTECH\MATLAB\Begin\photos\',srcFiles(i).name); I = rgb2gray(imread(filename)); %figure, imshow(I);
points1 = detectSURFFeatures(I);
% points2 = detectSURFFeatures(I2);
[features1(:,i), valid_points1(:,i)] = extractFeatures(I, points1);
%Match the features. end I2 = rgb2gray(imread('F:\MTECH\MATLAB\Begin\photos\im2.jpg')); points2 = detectSURFFeatures(I2); [features2, valid_points2] = extractFeatures(I2, points2); %Match the features. for i=1:length(srcFiles) indexPairs = matchFeatures(features1, features2);
matched_points1 = valid_points1(indexPairs(:, 1), :);
matched_points2 = valid_points2(indexPairs(:, 2), :);
figure; showMatchedFeatures(I, I2, matched_points1, matched_points2,'montage');
end
  1 个评论
Swarooph
Swarooph 2016-10-5
编辑:Swarooph 2016-10-5
Could you format your code (tutorial here ) above using the code option? You have commented some lines and have loops. Without the formatting its difficult to understand what's going on. Also paste the full error that you actually see on the MATLAB command window so that we can see which variable is throwing the error and at which line..

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by