title: Python "Fast normalized cross correlation"
body: <p>I am trying to use the implementation of "Fast Normalized cross correlation" ( <a href="http://pastebin.com/x1NJqWWm" rel="nofollow">http://pastebin.com/x1NJqWWm</a> ) in python to do some template matching. However, even for simple test-images, it produces values out of the [-1:1] range. I can't see what I am doing wrong. Is there a limitation of this algorithm? Help would be much appreciated!</p>
  
  <p>example:</p>
  
  <pre><code># Template creation
  t = np.zeros((4,4)) 
  t[:,0:3] = 1
  
  # Image creation
  image = np.zeros((15,15)) # image
  
  k=1
  for i in range(len(image)):
      if k==1:
          image[i,:]=1
          image[:,i]=1
          k=0
      else:
          k=1
  
  # Fast Normalized Cross Correlation
  TM = norm_xcorr.TemplateMatch(t, method='both')
  result2, ssd = TM(image)
  </code></pre>
  
  <p>This gives values out of the [-1:1] range:</p>
  
  <pre><code>&gt;&gt;&gt; np.max(result2)
  Out[6]: 8.4913641920299376
  &gt;&gt;&gt; np.min(result2)
  Out[7]: -3.1869961773458306
  </code></pre>