Re: [Image-SIG] quick pixelwise euclidean difference

2009-12-07 Thread Christopher Barker
Lauri Love (nsh) wrote: Let me know if there is any faster solution short of coding in some distance functions to the C modules You might do better with numpy and/or scipy.ndimage. You can convert a PIL RGB image to a numpy array very easily. I think it's as simple as: import numpy as np a

Re: [Image-SIG] quick pixelwise euclidean difference

2009-12-06 Thread Lauri Love (nsh)
Ok, I found a reasonable solution using the ImageStat module to get the sum of pixels of the difference image. This gives the manhattan distance when divided by the pixel count and averaged over RGB. In [151]: def idiff(im1,im2): return array(ImageStat.Stat(ImageChops.difference(im1,im2)).sum)