function t = cooc(x,k)
%
[m,n] = size(x);
t = zeros(m,n);
k2 = (k-1)/2;

xr = x(1:m,2:n-1);
xl = x(1:m,1:n-2);

pixcnt = (x==xr)+(x==xl);

for i1 = 1:m
  for j1 = 1:n
    cnt = sum(sum(pixcnt(i1-k2:i1+k2,j1-k2:j1+k2)));
  end;
end;

