Re: [Numpy-discussion] Question about slicing

2009-05-16 Thread Chris Colbert
the reason for all this is that the bitmap image format specifies the image origin as the lower left corner. This is the convention used by PIL. The origin of a numpy array is the upper right corner. Matplot lib does not handle this discrepancy in the function pil_to_array, which is called internal

Re: [Numpy-discussion] Question about slicing

2009-05-16 Thread Jorge Scandaliaris
Pauli Virtanen iki.fi> writes: > > img = array(img)[::-1] > > Note that here a copy is made. You can use `asarray` instead of `array` > if you want to avoid making a copy. > Thanks, that's good info! > > and it worked!, but I am interested actually in sub-regions of this > > image, so the n

Re: [Numpy-discussion] Question about slicing

2009-05-16 Thread Pauli Virtanen
Sat, 16 May 2009 22:05:16 +, Jorge Scandaliaris wrote: [clip] > I downloaded the scipy logo: > http://docs.scipy.org/doc/_static/scipyshiny_small.png and did the > following: > > img = Image.open('./scipyshiny_small.png') > > mpl.pylab.imshow(img) # Comes upside down > aimg = asarray(img) >

Re: [Numpy-discussion] Question about slicing

2009-05-16 Thread Jorge Scandaliaris
Emmanuelle Gouillart normalesup.org> writes: > > Hi Jorge, > > > roi = aimg[10:20,45:50,:] > > are you working with 3-D images? I didn't know PIL was able to handle 3D > images. > Well, if by 3D you mean color images then yes, PIL is able to handle them > I wasn't able to reproduce the beha

Re: [Numpy-discussion] Question about slicing

2009-05-16 Thread Pauli Virtanen
Sat, 16 May 2009 08:42:50 +, jorgesmbox-ml wrote: [clip] > I don't feel comfortable working with upside down images, so this had to > be fixed. I tried to be smart and avoid copying the whole image: > > aimg = array(img)[::-1] Note that here a copy is made. You can use `asarray` instead of `ar

Re: [Numpy-discussion] Question about slicing

2009-05-16 Thread Emmanuelle Gouillart
Hi Jorge, > roi = aimg[10:20,45:50,:] are you working with 3-D images? I didn't know PIL was able to handle 3D images. I wasn't able to reproduce the behavior you observed with a simple example: In [20]: base = np.arange(25).reshape((5,5)) In [21]: base Out[21]: array([[ 0, 1, 2, 3, 4],

[Numpy-discussion] Question about slicing

2009-05-16 Thread jorgesmbox-ml
Hi, I am just starting with numpy, pyhton and related others. I work on image processing basically. Now, my question is: what is the expected behaviour when slicing a view of an array? The following example might give some background on what I tried to do and the results obatined (which I don'