comparing single image with many images

4 ビュー (過去 30 日間)
Padmapriya
Padmapriya 2013 年 3 月 30 日
コメント済み: Image Analyst 2018 年 7 月 15 日
I have written a matlab function that enables me to get the name of image from user and compare it with the existing images and display if it matches or not..
function matchin
handles = guidata(gcbo);
set(handles.h_text,'String','performing matching...');
[image1, pathname]= uigetfile('*.bmp','Open An Fingerprint image');
Directory = fullfile ('F:','matlab','bin');
D = dir(fullfile(Directory,'*.bmp'));
set(handles.h_text,'String','matching complete....');
for i = 1:numel(D)
if strcmp(image1,D(i).name)
disp('matched');
else
disp('not matched');
end
end
the above code checks if the file name exists but i now want to compare the images itself instead of the file name. How can I do that?Please help..
Regards
Priya
  9 件のコメント
sirisha boddapati
sirisha boddapati 2018 年 7 月 15 日
The prgrm shows error in line 4 ...what should we do??? Plz ans this...
Image Analyst
Image Analyst 2018 年 7 月 15 日
You should start a new question of your own with all the source code, data, and error messages needed for us to help you.

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2013 年 3 月 31 日
How do you define a match? If all pixels are the same, and only one single pixel is different by only 1 gray level? Is that a match or not a match? If you say that's not a match, then first just compare the number of rows, columns, and color channels. Then if all those match, simply subtract the image (after converting to floating point) and look for any non-zero values with nnz();
diffImage = single(image1) - single(image2);
imagesMatch = nnz(diffImage(:)) == 0;
  21 件のコメント
Padmapriya
Padmapriya 2013 年 4 月 13 日
I used
D = dir(fullfile(Directory,'*.jpg'));
imcell = {D.name}';
to get the file names present in the folder and then used imread() to read the image. There are three images in the folder
'min.jpg'
'min1.jpg'
'min2.jpg'
But I am getting the error that the last image does not exist. Why is that?
not matched
not matched
Error using imread (line 369)
File "min2.jpg" does not exist.
Error in org (line 215)
image13=imread(imcell{i});
Image Analyst
Image Analyst 2013 年 4 月 13 日
Well apparently it doesn't exist. Follow the second code example in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F

サインインしてコメントする。

その他の回答 (2 件)

gagan deep
gagan deep 2014 年 6 月 15 日
this code will not run can u send me full code !. gdeep90singh@gmail.com thanks

Umara Zafar
Umara Zafar 2017 年 6 月 9 日
編集済み: Image Analyst 2017 年 6 月 9 日
I used the same code for my project
function matchin
handles = guidata(gcbo);
set(handles.h_text,'String','performing matching...');
[image1, pathname]= uigetfile('*.bmp','Open An Fingerprint image');
Directory = fullfile ('F:','matlab','bin');
D = dir(fullfile(Directory,'*.bmp'));
set(handles.h_text,'String','matching complete....');
for i = 1:numel(D)
if strcmp(image1,D(i).name)
disp('matched');
else
disp('not matched');
end
end
But i'm getting this error "H must be the handle to a figure or figure descendent." Anyone can help ? Thanks
  1 件のコメント
Image Analyst
Image Analyst 2017 年 6 月 9 日
There is no capital H in your code. Post a new, separate question and post all the red text so we can see the actual line of code that is throwing the error.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by