image thumbnail

CCRE for Multi-Modal Image Registration

by

 

CCRE , the Cross Cumulative Residual Entropy of two images.

test_ccre
function test_ccre
% test for the function  f = ccre(I1,I2)
% to calculate the CCRE between two images
 img = imread('peppers.png');
 im2 = img(:,:,2); % green component of the RGB image
 im3 = img(:,:,3); % blue  component of the RGB image
 [h w] = size(im2);
 p2 = im2(h/2-50:h/2+50,w/2-50:w/2+50);         % a patch in the middle of im2
 f = [];
 for t = -50:50
     p3 = im2(h/2-50:h/2+50,t+w/2-50:t+w/2+50); % a patch around the middle of im3
     f = [ f ccre(p2,p3)];
 end
 figure,imshow(im2),title('the Green component of the RGB image');
 figure,imshow(im3),title('the Blue component of the RGB image');
 figure,plot(f),title('the CCRE value between two patchs from the left to right side');
 
 
function f = ccre(I1,I2)
% CCRE,which is more general than the Shannon Entropy,determines the Cross Cumulative Residual Entropy of two images.
%  References:
% [1]Wang, F. and B.C. Vemuri, Non-rigid multi-modal image registration
% using cross-cumulative residual entropy. International journal of computer vision, 2007
% [2]Hasan, M., M.R. Pickering and X. Jia, Robust Automatic Registration of
% Multimodal Satellite Images Using CCRE With Partial Volume Interpolation. 2012.
%
% Sorry for my poor English
% huxb@whu.edu.cn

[h,w] = size(I1); 
if  ne(h,size(I2,1))||ne(w,size(I2,2))
    error('the two images should be the same size ! ');
end

max1 = max(I1(:)); min1 = min(I1(:));
max2 = max(I2(:)); min2 = min(I2(:));
N1 = max1-min1+1;   N2 = max2-min2+1;
% Joint histogram
ht  = zeros(N1,N2);  
for x = 1:h    
    for y = 1:w
        ht( I1(x,y)-min1+1,I2(x,y)-min2 + 1) =  ht( I1(x,y)-min1+1,I2(x,y)-min2 + 1) + 1;
    end
end
% Marginal histogram, which are the histogram of image I1 and I2. 
h1 = sum(ht );  
h2 = sum(ht');
% normalization
ht = ht/sum(ht(:));
h1 = h1/sum(h1);
h2 = h2/sum(h2);
% Marginal cumulative distribution of image I1
c1 = h1;
for i=1:N2-1;   
    c1(i+1) = c1(i+1) + c1(i);
end
% Calculate the CCRE
f = 0;
for i = 1:N1  
    for j = 1 : N2-1
        ht(i,j+1) = ht(i,j+1) + ht(i,j);
        if( (ht(i,j)>0) && (c1(j)>0) && ( h2(i)>0) )
            f = f - ht(i,j)*log2( ht(i,j) / (c1(j)*h2(i))); 
        end
    end 
end

Contact us