[Numpy-discussion] Optimizing speed for large-array inter-element algorithms (specifically, color space conversion)

Hans Meine meine@informatik.uni-hamburg...
Mon Jan 21 09:57:14 CST 2008


Am Montag, 21. Januar 2008 15:39:21 schrieb theodore test:
> Right now it takes around 9 seconds for a single 1600x1200 RGB image, a
> conversion that I've seen implemented more or less instantly in, say,
> ImageJ.  What can I do to make this conversion more efficient?

You should "just remove" the loop.  Try to convert all operations to 
elementwise array/matrix-operations, which are very fast.  IOW, make the 
algorithm work on all pixels in parallel.  The only tricky part is the 
conditional operation, but you can emulate that with the binary operators and 
e.g. put().

-- 
Ciao, /  /
     /--/
    /  / ANS


More information about the Numpy-discussion mailing list