function c = Laws(size,first,second)
%
% Laws - produce Laws texture convolution mask
% On input:
%     size: size of Laws convolution mask (3,5, or 7)
%     first: Laws vector for first vector in outer product
%     second: Laws vector for second vector in outer product
% On output:
%     c: convolution mask
% Call:
%     c = Laws(size,first,second);
%

c = zeros(size,size);

L3 = [ 1 2 1; -1 0 -1; -1 2 -1];

L5 = [ 1  4 6  4  1;
      -1 -2 0  2  1;
      -1  0 2  0 -1;
      -1  2 0 -2  1;
       1 -4 6 -4  1];

L7 = [  1  6  15 20  15  6  1;
       -1  4  -5  0   5  4  1;
       -1 -2   1  4   1 -2 -1;
       -1  0   3  0  -3  0  1;
        1 -2  -1  4  -1 -2  1;
       -1  6 -15 20 -15  6 -1];

if size == 3
  c = L3(first,:)'*L3(second,:);
elseif size == 5
  c = L5(first,:)'*L5(second,:);
elseif size == 7
  c = L7(first,:)'*L7(second,:);
end;