%  A = not_an_edge(DoG,row,col,R)
%  computes the hessian to determine whether or not row,col is along 
%  an edge. 
%  row >= 2 
%  col >= 2
%  row <= size(DoG,1)
function [A,eigen_vectorz] = nae2(DoG, row, col, R, w)

  halfw = floor(w/2);

  patch = DoG([row-halfw:row+halfw],[col-halfw:col+halfw]);

  [dX dY] = gradient(patch);
  
  dXdY = mean(dX(:).*dY(:));
  H = [mean(dX(:).^2) dXdY; dXdY mean(dY(:).^2)];

  A = 0;
  [v d] = eig(H);
  eigen_vectorz = v;
  eigval=diag(d);
  if eigval(1) ~= 0 && eigval(2) ~= 0 && det(H) > 0 ...
	&&  eigval(1)/eigval(2) < R,
      A = 1;
  end;

%    if (det(H) < 0)
%      A = 0;
%    else
%      A = ((trace(H).^2/det(H)) < ((R + 1)^2)/R);
%    end
