[Numpy-discussion] Matlab/Numpy index order

Robert Kern robert.kern@gmail....
Tue May 12 15:47:51 CDT 2009

On Tue, May 12, 2009 at 15:32, Chris Colbert <sccolbert@gmail.com> wrote:
> This is interesting.
> I have always done RGB imaging with numpy using arrays of shape (height,
> width, 3). In fact, this is the form that PIL gives when calling
> np.asarray() on a PIL image.
> It does seem more efficient to be able to do a[0],a[1],a[2] to get the R, G,
> and B channels respectively. This, obviously is not currently the case.

It's not *that* much more efficient.

> Would it be better for me to switch to this way of doing things  and/or work
> a patch for PIL so that the array is built in the form (3, height, width)?

Submitting a patch for PIL would neither be successful, nor worth your
time. Not to mention breaking existing code.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the Numpy-discussion mailing list