I want to compare (features) 300 images with other 300 images using SURF detectors.
With the program below, I'm facing a problem. With the 1st folder, all images are matching with only 1 image of 2nd folder.
But I want to match all 300 images with 300 images.
Can anyone help ?
path_directory_1 = 'fall';
original_files_1 = dir([path_directory_1 '/*.png']);
path_directory_2 = 'winter';
original_files_2 = dir([path_directory_2 '/*.png']);
for i = 1:length(original_files_1)
filename = ([path_directory_1 '/' original_files_1(i).name]);
I1 = rgb2gray(imread(filename))
points1 = detectSURFFeatures(I1)
[f1,vpts1] = extractFeatures(I1, points1)
for j = 1:length(original_files_2)
filename = ([path_directory_2 '/' original_files_2(j).name]);
I2 = rgb2gray(imread(filename))
points2 = detectSURFFeatures(I2)
[f2,vpts2] = extractFeatures(I2, points2)
end
indexPairs = matchFeatures(f1,f2)
matchedPoints1 = vpts1(indexPairs(:,1))
matchedPoints2 = vpts2(indexPairs(:,2))
figure; ax = axes;
showMatchedFeatures(I1, I2, matchedPoints1, matchedPoints2,'montage','Parent',ax);
legend(ax,'matchedPoints1','matchedPoints2');
end

 채택된 답변

Image Analyst
Image Analyst 2020년 7월 8일

0 개 추천

Works for me. Try this more robust code and tell me what you see in the command window:
path_directory_1 = 'fall';
% path_directory_1 = pwd;
path_directory_2 = 'winter';
% path_directory_2 = pwd;
% Alert user if either folder does not exist, then exit.
if ~isfolder(path_directory_1)
warningMessage = sprintf('Folder %s does not exist.', path_directory_1);
uiwait(errordlg(warningMessage));
return;
end
if ~isfolder(path_directory_2)
warningMessage = sprintf('No %s files found in folder %s', path_directory_2);
uiwait(errordlg(warningMessage));
return;
end
% Get file names.
filePattern = fullfile(path_directory_1, '/*.png');
original_files_1 = dir(filePattern);
filePattern = fullfile(path_directory_2, '/*.png');
original_files_2 = dir(filePattern);
% Alert user if either folder does not have any files in it.
if isempty(original_files_1)
warningMessage = sprintf('No %s files found in folder %s', filePattern, path_directory_1);
uiwait(warndlg(warningMessage));
end
if isempty(original_files_2)
warningMessage = sprintf('No %s files found in folder %s', filePattern, path_directory_2);
uiwait(warndlg(warningMessage));
end
for i = 1:length(original_files_1)
filename = ([path_directory_1 '/' original_files_1(i).name]);
fprintf('\nComparing folder 1 file "%s"\n', filename);
for j = 1:length(original_files_2)
filename = ([path_directory_2 '/' original_files_2(j).name]);
fprintf(' to folder 2 file "%s"\n', filename);
end
end

댓글 수: 9

Its displaying
Comparing folder 1 file "fall/image-00001.png"
to folder 2 file "winter/image-00001.png"
to folder 2 file "winter/image-00002.png"
to folder 2 file "winter/image-00003.png"
to folder 2 file "winter/image-00004.png"
to folder 2 file "winter/image-00005.png" and so on.....
Thanks alot
I have one more question:
For the same I have to create precision recall curve :
for that i have ground truth data
how can I create Precision-Recall curve ???
Sorry, I don't know the definition of that term.
Okie no problem
Can you tell me how to construct Similarity Matrix
Sorry, I don't know what that is and I've never used it. What do the rows and columns of the matrix represent?
Similarity between 2 images that should be stored in a Matrix form. Can you help in this?
Thanks in advance !
Sorry, no. You still have not defined it. What are you using for the similarity metric? PSNR? SSIM? The Dice Sorensen coefficient? MSE? Delta E? Something else?
And you chose not to answer my direct question "What do the rows and columns of the matrix represent?" so what can I do? Not much at this point.
The similarity values in the similarity matrix are computed from the matchings: S(A,B) is the similarity of images A and B based on the matched features from both images.
The Matrix rows and columns represent the matched features of images in terms of binary
Sorry, I can't help you. S() is not a built-in function of MATLAB so presumably it's a custom function that you already have so go ahead and use it. And "the matched features of images in terms of binary" makes no sense to me so perhaps an example would help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB Support Package for USB Webcams에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by