what is the MATLAB code for finding out the canberra distance between query image and images in the database.

1 view (last 30 days)
actually i have query image and 48 images in the databases.i have implemented the CBIR system but now i have to measure Canberra distance.i have measured the euclidean distance in the following program but now i want to measure canberra distance in place of euclidean distance.The following code gives the implementation of CBIR system.but i want to find the canberra distance..pleaase help me..thanks
clc;
G=imread('spine.tif');
H = adapthisteq(G,'clipLimit',0.01,'Distribution','rayleigh');
[rows cols]=size(H);
[c1,s1]=wavedec2(H,1,'db1');
%disp(c1);
X=c1;
%figure,imshow(G);
%figure,imshow(H);
fileFolder=fullfile(matlabroot,'toolbox','images','imdata');
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,'clipLimit',0.01,'Distribution','rayleigh');
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);
firstFiveImages = IX(1:5);
for I = 1:length(firstFiveImages)
figure;imshow(imread(fileNames{firstFiveImages(I)}));
end
  5 Comments
Rima
Rima on 4 Jun 2013
i only want the formula.As in case of Euclidean distance,E_distance = sqrt(sum((X-Y).^2)) is used in MATLAB. Similarly what is the formula for Canberra distance in MATLAB.please help me.thanks

Sign in to comment.

Answers (0)

Categories

Find more on Write Data to Channel in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!