图像相似度

2019-05-23  本文已影响0人  Vincy_ivy
%计算图像直方图距离
%巴氏系数计算法

M=imread('22.jpg');
N=imread('22.jpg');
I=rgb2gray(M);
J=rgb2gray(N);

[Count1,x]=imhist(I);
[Count2,x]=imhist(J);
Sum1=sum(Count1);Sum2=sum(Count2);
Sumup = sqrt(Count1.*Count2);
SumDown = sqrt(Sum1*Sum2);
Sumup = sum(Sumup);
figure(1);
subplot(2,2,1);imshow(I);
subplot(2,2,2);imshow(J);
subplot(2,2,3);imhist(I);
subplot(2,2,4);imhist(J);
%imhist(HistDist);
HistDist=1-sqrt(1-Sumup/SumDown);
%sprintf('%lf',HistDist);
上一篇下一篇

猜你喜欢

热点阅读