How is "Joint class histogram" algorithm deploy using Matlab?
I get the answer from another source and I deploy like this

% load floating and fix image

%% image segmentation using k-mean clustring.
idx_fix = kmeans(double(fix(:)),4);    
idx_float = kmeans(double(float(:)),4);

%% display image segmentation
mat1 = reshape(idx_fix,[],500);%besed on your image size
mat2  = reshape(idx_float,[],500);
imshow(mat1/max(mat1(:))); title('Fix image class');
figure;
imshow(mat2/max(mat2(:))); title('Float image class');

%% Joint class histogram
joint = zeros(5,5);%besed on number of class    
for i=1:length(idx_fix)
   c1 = idx_fix(i) + 1;%offset matrix by 1 because index start by 1
   c2 = idx_float(i) + 1;
   joint(c1, c2) =  joint(c1,c2) + 1;    
end


If the image aligned correctly the joint class histogram result as a diagonal line.



Thanks, Walter Roberson