Request for help with Image color space conversion

caca at mailinator.com caca at mailinator.com
Sun Jan 6 14:18:42 EST 2008


>
> ...where the image data is loaded into a numpy array
> (1600x1200x3)...


One comment: that is a big array, too big for the cache memory. I know
that in these cases it makes a difference how many times the slices of
the array are loaded and unloaded from RAM onto cache. One issue is
that a 2D array l[i,j] is actually a 1D array:
either
l[i,j]=l[i*N+j]
or
l[i,j]=l[j*N+i]
I don't know which in python/numpy. In the first case, when you fix i
and change j, you get consecutive positions  in the underlying 1D
array, and they all belong to the same slice, which is loaded onto
cache very fast as a block. If you do the opposite, you are making
jumps to distant positions in the array (not a slice), and performance
suffers.

In gimp, for example, the underlying array is split into 'tiles',
which are 64x64 pixel regions that can be loaded/unloaded as a block.
And that's about all I know on the issue.

So it ma









More information about the Python-list mailing list