MATLAB: Please help me out in rectifying the errors in implementing Content Based Image Retrieval System.

cbirimage processingWavelet Toolbox

I have 56 images in a database.i want to display and coompare best five images with the query image using eucledian distance.the problem which i get is that the result doesnot show best five images instead its showing only one image which is the query image.my program is:
PROGRAM NO 1:
clc;
G=imread('n252.tif');
H = adapthisteq(G);
[rows cols]=size(G);
[c1,s1]=wavedec2(H,1,'db1');
%disp(c1);
X=c1;
figure,imshow(G);
%figure,imshow(H);
fileFolder=fullfile(matlabroot,'toolbox','images','imphoto');
dirOutput=dir(fullfile(fileFolder,'*.tif'));
fileNames={dirOutput.name}
n=numel(fileNames)
g=zeros(1,n);
for k = 1 : n
fileNames1=strcat('fullfile(fileFolder)',fileNames(k))
I = imread(fileNames{k});
J = adapthisteq(I);
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
the error came as follows:
??? Error using ==> images\private\checkinput>check_attributes
Function ADAPTHISTEQ expected its first input argument, I,
to be two-dimensional.
Error in ==> images\private\checkinput at 37
check_attributes(A, attributes, function_name, variable_name, …
Error in ==> adapthisteq>parseInputs at 411
checkinput(I, {'uint8' 'uint16' 'double'}, …
Error in ==> adapthisteq at 155
[I, selectedRange, fullRange, numTiles, dimTile, clipLimit, numBins, …
Error in ==> new at 18
J = adapthisteq(I,'clipLimit',0.02,'Distribution','rayleigh');
please help me out in rectifing these errors..
actualy i have done the same program but with different database.in that case the result came out but when i have changed the database the above problem persists..
the same program which is done by using different database is as follows(here the result came):
PROGRAM NO 2:
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
here in program no 2 no such error is coming.so i want to know what is the mistake in program no 1.the result is coming in program no 2 but in program no 1 no result is coming instead the errors are coming.though the two programs are same only the difference is that i have taken different databases in these two above mentioned programs..Thanks

Best Answer

adapthisteq() doesn't work with color images.
Anyway, there is no CBIR that I can see in your code. You're just comparing the intensities of the wavelet images. I could be wrong because I'm not a wavelet guy, but I don't think that will allow you to do things like "show me all pictures with a beach in them" or "show me all photos with a dog in them", etc.