What is the procedure of finding out the accuracy of the images in matlab?

Actually i have find out eucledian distance of the query image and the images in the databases..Now my question is that how to find out the accuracy in the images using matlab..please help me.Thank you..

3 Comments

Actually i have find out eucledian distance of the query image and the images in the databases..Now my question is that how to find out the accuracy in the images using matlab..Please help me.Thank you.
i have done the program given below..please help me to find the accuracy in all the images..thank you.
clc;
G=imread('lion1.jpg');
G1=rgb2gray(G);
H = adapthisteq(G1);
[rows cols]=size(G1);
[c1,s1]=wavedec2(H,1,'db1');
%disp(c1);
X=c1;
figure,imshow(G);
%figure,imshow(H);
fileFolder=fullfile(matlabroot,'toolbox','images','imda');
dirOutput=dir(fullfile(fileFolder,'*.jpg'));
fileNames={dirOutput.name}
n=numel(fileNames)
g=zeros(1,n);
for k = 1 : n
fileNames1=strcat('fullfile(fileFolder)',fileNames(k))
I = imread(fileNames{k});
I1=rgb2gray(I);
J = adapthisteq(I1);
J = imresize(J, [rows cols]);
[c2,s2]=wavedec2(J,1,'db1');
%disp(c2);
Y=c2;
%[rows1 cols1]=size(J);
E_distance = sqrt(sum((X-Y).^2));
g(1,k)=E_distance;
if g(1,k)==0
w=k;
end
%figure,imshow(I);
%figure,imshow(J);
end
disp(g);
%II=imread(fileNames{w});
%figure, imshow(II);
[sorted,IX] = sort(g);
bestFiveImages = IX(1:5);
for I = 1:length(bestFiveImages)
figure;imshow(imread(fileNames{bestFiveImages(I)}));
end
Editing away your question is very very much despised and will lead to people not answering your questions in the future.
I have restored the original text of this question.
diva dave anthony: this question has a clear subject and an accepted answer, so it may be valuable to someone else in the future. If you have a good reason why it should be removed from MATLAB Answers, please flag the question, explain why it should be deleted, and an administrator or high-reputation contributor will consider deleting the question. Please do not simply edit your question away.

Sign in to comment.

 Accepted Answer

Assuming you found the best five images correctly, change the last few lines to this (untested):
figure;
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
for k = 1:length(bestFiveImages)
subplot(2, 3, k);
fullFileName = fullfile(pwd, fileNames{bestFiveImages(k)});
if exist(fullFileName , 'file')
imshow(imread(fullFileName));
title(fullFileName, 'FontSize', 20);
else
warningMessage = sprintf('Warning: file not found:\n%s', fullFileName);
uiwait(warndlg(warningMessage));
end
end

11 Comments

will this code help me find out the accuracy and where i have to change the codes ?is the code will be the following way
clc;
G=imread('lion1.jpg');
G1=rgb2gray(G);
H = adapthisteq(G1);
[rows cols]=size(G1);
[c1,s1]=wavedec2(H,1,'db1');
%disp(c1);
X=c1;
figure,imshow(G);
%figure,imshow(H);
fileFolder=fullfile(matlabroot,'toolbox','images','imda');
dirOutput=dir(fullfile(fileFolder,'*.jpg'));
fileNames={dirOutput.name}
n=numel(fileNames)
g=zeros(1,n);
for k = 1 : n
fileNames1=strcat('fullfile(fileFolder)',fileNames(k))
I = imread(fileNames{k});
I1=rgb2gray(I);
J = adapthisteq(I1);
J = imresize(J, [rows cols]);
[c2,s2]=wavedec2(J,1,'db1');
%disp(c2);
Y=c2;
%[rows1 cols1]=size(J);
E_distance = sqrt(sum((X-Y).^2));
g(1,k)=E_distance;
if g(1,k)==0 w=k;
end %figure,imshow(I);
%figure,imshow(J);
end
disp(g);
%II=imread(fileNames{w});
%figure, imshow(II);
[sorted,IX] = sort(g);
bestFiveImages = IX(1:5);
for I = 1:length(bestFiveImages)
figure;
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
for k = 1:length(bestFiveImages)
subplot(2, 3, k);
fullFileName = fullfile(pwd, fileNames{bestFiveImages(k)});
if exist(fullFileName , 'file')
imshow(imread(fullFileName));
title(fullFileName, 'FontSize', 20);
else
warningMessage = sprintf('Warning: file not found:\n%s',
fullFileName);
uiwait(warndlg(warningMessage));
end
end
i have done in this way.bit the error came as
??? Error: File: C:\MATLAB7\work\rima.m Line: 53 Column: 4 This statement is incomplete.
please help me out...thank you
actualy i want to display all the images of the lion..but it is displaying lions as well as horses..i mean there should be the accuracy of the images...please help me.thank you
That's because you still have the loop over I, which I told you to replace with my code:
for I = 1:length(bestFiveImages)
Get rid of it. I have the loop over k so you don't need the loop over the (badly-named) I.
ya i have corrected it now..but the result is coming 5 images in single window..but i want all the images should be of either lion or horse,i.e it should be accurate..what is the command for the accuracy of the images using MATLAB?thank you
Then remove the subplot and put the figure command in the loop:
for k = 1:length(bestFiveImages)
figure;
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
fullFileName = fullfile(pwd, fileNames{bestFiveImages(k)});
if exist(fullFileName , 'file')
imshow(imread(fullFileName));
title(fullFileName, 'FontSize', 20);
else
warningMessage = sprintf('Warning: file not found:\n%s', fullFileName);
uiwait(warndlg(warningMessage));
end
end
We don't understand your question on accuracy. It appears you calculated the RMS error between images. Is that not what you wanted to do?
i want all the 5 images should be of lion or only horses in the database of images of tigers and horses.
Your code definitely definitely WON'T do that. You need to look up CBIR (Content Based Image Retrieval). It's not trivial and is the topic of dozens or hundreds of research groups right now.
ok..thanks for the reply..but what wiil be the code for that?can u please suggest...

Sign in to comment.

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!