[Image-SIG] quick pixelwise euclidean difference

Christopher Barker Chris.Barker at noaa.gov
Mon Dec 7 19:45:35 CET 2009


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

arr = np.asarray(pil_image)


Then you have a WxHx3 array of uint8 values you can do all sorts of math on.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov


More information about the Image-SIG mailing list