Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If your problem is about shifted pixels, maybe you should compare against a frequency transform.</p> <p>The FFT should be OK (<a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.fft2.html#numpy.fft.fft2" rel="nofollow noreferrer">numpy has an implementation for 2D matrices</a>), but I'm always hearing that Wavelets are better for this kind of tasks ^_^ </p> <p>About the performance, if all the images are of the same size, if I remember well, the FFTW package created an specialised function for each FFT input size, so you can get a nice performance boost reusing the same code... I don't know if numpy is based on FFTW, but if it's not maybe you could try to investigate a little bit there.</p> <p>Here you have a prototype... you can play a little bit with it to see which threshold fits with your images.</p> <pre><code>import Image import numpy import sys def main(): img1 = Image.open(sys.argv[1]) img2 = Image.open(sys.argv[2]) if img1.size != img2.size or img1.getbands() != img2.getbands(): return -1 s = 0 for band_index, band in enumerate(img1.getbands()): m1 = numpy.fft.fft2(numpy.array([p[band_index] for p in img1.getdata()]).reshape(*img1.size)) m2 = numpy.fft.fft2(numpy.array([p[band_index] for p in img2.getdata()]).reshape(*img2.size)) s += numpy.sum(numpy.abs(m1-m2)) print s if __name__ == "__main__": sys.exit(main()) </code></pre> <p>Another way to proceed might be blurring the images, then subtracting the pixel values from the two images. If the difference is non nil, then you can shift one of the images 1 px in each direction and compare again, if the difference is lower than in the previous step, you can repeat shifting in the direction of the gradient and subtracting until the difference is lower than a certain threshold or increases again. That should work if the radius of the blurring kernel is larger than the shift of the images.</p> <p>Also, you can try with some of the tools that are commonly used in the photography workflow for blending multiple expositions or doing panoramas, like the <a href="http://wiki.panotools.org/Align_image_stack" rel="nofollow noreferrer">Pano Tools</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload