I am using Pillow and numpy, but have a problem with conversion between Pillow Image object and numpy array.
when I execute following code, the result is weird.
im = Image.open(os.path.join(self.img_path, ifname))
in_data = np.asarray(im, dtype=np.uint8)
im maybe column-major while arrays in numpy are row-major
in_data = in_data.T to transpose the python array
probably should check in_data with
imshow to make sure the picture looks right.
But do you know that matplotlib comes with its own loading functions that gives you numpy arrays directly? See: http://matplotlib.org/users/image_tutorial.html