function [e,borip] = canny(a,s,k)
%
% canny: returns Canny edge image (not thresholded; see R. Jain, Machine 
%        Vision, p. 169)
% On input:
%          a: input image
%          s: sigma for Gaussian blur
%          k: window size for convolution
% On output:
%          e: output is magnitude
%      borip: orientation of edge (0 to 2*pi)
% Call:
%     [e,borip] = canny(a,s,k)
%

b = gblur(a,s,k);
[bdx,bdy] = gradient(b);
[bmag,bori] = magori(bdx,bdy);
borip = posori(bori);
bsec = sector(borip);
bnms = nms(bmag,bsec);
[m,n] = size(bnms);
for i1 = 1:m
  for j1 = 1:n
    if bnms(i1,j1) == 0
      borip(i1,j1) = 0;
    end
  end
end
e = bnms;
