title: How to perform image cross-correlation with subpixel accuracy with scipy
body: <p>The image below shows two circles of same radius, rendered with antialiasing, only that the left circle is shifted half pixel horizontally (notice that the circle horizontal center is at the middle of a pixel at the left, and at the pixel border at the right).</p>
  
  <p>If I perform a cross-correlation, I can take the position of the maximum on the correlation array, and then calculate the shift. But since pixel positions are always integers, my question is:</p>
  
  <p>"How can I obtain a sub-pixel (floating point) offset between two images using cross-correlation in Numpy/Scipy?"</p>
  
  <p>In my scripts, am using either of <code>scipy.signal.correlate2d</code> or <code>scipy.ndimage.filters.correlate</code>, and they seem to produce identical results.</p>
  
  <p>The circles here are just examples, but my domain-specific features tend to have sub-pixel shifts, and currently getting only integer shifts is giving results that are not so good...</p>
  
  <p>Any help will be much appreciated!</p>
  
  <p><img src="https://i.stack.imgur.com/UsSar.png" alt="enter image description here"></p>