[Numpy-discussion] Matlab/Numpy index order
Tue May 12 15:32:40 CDT 2009
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,a,a to get the R, G,
and B channels respectively. This, obviously is not currently the case.
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)?
On Tue, May 12, 2009 at 4:14 PM, David Warde-Farley <firstname.lastname@example.org>wrote:
> On 12-May-09, at 3:55 PM, Ryan May wrote:
> > It's going to be faster to do it without the transpose. Besides,
> > for numpy,
> > that imshow becomes:
> > imshow(b)
> > Which, IMHO, looks better than Matlab.
> You're right, that is better, odd how I never thought of doing it like
> that. I've been stuck in my Matlab-esque world with dstack() as my
> default mental model of how images/matrices ought to be stacked.
> Am I right in thinking that b is stored in a big contiguous block
> of memory, thus making the read marginally faster than slicing on the
> Numpy-discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion