www.pudn.com > duge.rar > comb_entropy.m, change:2014-11-09,size:772b


function [ value ] = comb_entropy( I,J,F ) 
%COMB_ENTROPY Summary of this function goes here 
%   Detailed explanation goes here 
 
 [rows,cols] = size(I); 
 h_IF = zeros(256,256); 
 h_JF = zeros(256,256); 
 for k = 1:rows 
     for l = 1:cols 
         h_IF(I(k,l)+1,F(k,l)+1) = h_IF(I(k,l)+1,F(k,l)+1)+1; % 更新联合直方图 
         h_JF(J(k,l)+1,F(k,l)+1) = h_JF(J(k,l)+1,F(k,l)+1)+1;  
     end 
 end 
 h_IF=h_IF/max(max(h_IF)); 
 h_JF=h_JF/max(max(h_JF)); 
 value1=0; 
 value2=0; 
 for i=1:256 
     for j=1:256 
         if h_IF(i,j)~=0             
             value1=value1+h_IF(i,j)*log2(h_IF(i,j)); 
         end 
         if h_JF(i,j)~=0 
             value2=value2+h_JF(i,j)*log2(h_JF(i,j)); 
         end 
     end 
 end 
 value=-(value1+value2); 
 
 
end