function [h, ind]=comp_hist(I)
h=zeros([1 (max(max(I))-min(min(I)))+1]);
min_val = min(min(I));
ind = min_val:max(max(I));
for i=1:size(I,1),
  for j=1:size(I,2),
    p=floor((I(i,j)-min_val))+1;
    h(p) = h(p)+1;
  end
end
return;

