title: Implementing a Harris corner detector
body: <p>I am implementing a Harris corner detector for educational purposes but I'm stuck at the harris response part. Basically, what I am doing, is:</p>
  
  <ol>
  <li>Compute image intensity gradients in x- and y-direction</li>
  <li>Blur output of (1)</li>
  <li>Compute Harris response over output of (2)</li>
  <li>Suppress non-maximas in output of (3) in a 3x3-neighborhood and threshold output</li>
  </ol>
  
  <p>1 and 2 seem to work fine; however, I get very small values as the Harris response, and no point does reach the threshold. Input is a standard outdoor photography.</p>
  
  <pre><code>[...]
  [Ix, Iy] = intensityGradients(img);
  g = fspecial('gaussian');
  Ix = imfilter(Ix, g);
  Iy = imfilter(Iy, g);
  H = harrisResponse(Ix, Iy);
  [...]
  
  function K = harrisResponse(Ix, Iy)
      max = 0;
      [sy, sx] = size(Ix);
      K = zeros(sy, sx);
      for i = 1:sx,
          for j = 1:sy,
              H = [Ix(j,i) * Ix(j,i), Ix(j,i) * Iy(j,i)
                  Ix(j,i) * Iy(j,i), Iy(j,i) * Iy(j,i)];
              K(j,i) = det(H) / trace(H);
              if K(j,i) &gt; max,
                  max = K(j,i);
              end
          end
      end
      max
  end
  </code></pre>
  
  <p>For the sample picture, max ends up being 6.4163e-018 which seems far too low.</p>