|
From: Pauli V. <pa...@ik...> - 2009-05-17 12:00:11
|
Sun, 17 May 2009 00:15:48 -0400, Jae-Joon Lee wrote: > On Sat, May 16, 2009 at 6:58 PM, > <jor...@ya...> wrote: >> >> Hi, >> I want to read images and do some processing with them. While learning >> how to do this, i.e. opening images, displaying them, transforming them >> tu numpy arrays, etc., I came across a strange behaviour. If I open an >> image and use imshow() to display it, it comes upside down. See this >> thread in the numpy mailing list for more details: >> http://thread.gmane.org/gmane.comp.python.numeric.general/30148 . >> Someone on that list suggested to check here if this behavior was >> correct. Is it normal that the image appears upside down? If yes, can >> someone explain what's going on? > > Note that the image may be upside down for you but may be correct for > others. The array itself does not know about the orientation of the > image and you have to explicitly specify this. I think the point here is that img = Image('foo.png') imshow(img) and img = Image('foo.png') imshow(asarray(img)) give different results, since matplotlib.image.pil_to_array functions differently from what PIL exposes in __array_interface__ -- Pauli Virtanen |