function hmg = toocm8(a,l);
% coocm8 - Finds homogeneity of a matrix
% On input   
%     a: gray level matrix
% On output:
%     hmg - measure of homogeneity
% Call:
%     hmg = coocm8(a);
%
       
[m,n] = size(a);

sum = 0; 
for r1 = 1:m
  for c1 = 1:n
    denom = 1 + abs((r1-1)-(c1-1));
    sum = sum + (a(r1,c1)^l)/denom;
  end
end

hmg = sum;

