www.pudn.com > duge.rar > cross_entropy.m, change:2015-06-01,size:457b


function [ value ] = cross_entropy( I1,I2 ) 
%CROSS_ENTROPY 此处显示有关此函数的摘要 
%   交叉熵,值越小说明图像差异越小,即融合效果越好 
% I2为融合图像 
I1=rgb2gray(I1); 
[counts1,x]=imhist(I1); 
counts1=counts1/(size(I1,1)*size(I1,2)); 
I2=rgb2gray(I2); 
[counts2,x]=imhist(I2); 
counts2=counts2/(size(I2,1)*size(I2,2)); 
E=0; 
for i=0:255 
    if(counts1(i+1)~=0) 
       E=E+counts1(i+1)*log2(counts1(i+1)/counts2(i+1)); 
    end 
end 
value=E; 
end