Reversed X an Y when convering PIL images to NumPy arrays
"Yury V. Zaytsev" <[email protected]>
| Newsgroups | gmane.comp.python.image |
|---|---|
| Message-ID | <1271686066.7093.58.camel@mypride> |
Hi!
Is it normal when I execute the following code I get the red dot at X =
200, Y = 100 on the plot?! I would have expected to be able to address
pixels in the resulting array in a usual p[X, Y] format.
I might be blind, but I haven't found anything in the documentation.
Actually I have found out about the possibility to interface with Numpy
itself at some blog: http://effbot.org/zone/pil-changes-116.htm .
import Image
import numpy as np
import pylab as pyl
if __name__ == "__main__":
img_name = 'ch43_roi.tiff'
img = Image.open(img_name)
a = np.asarray(img)
p = a.copy()
p[100, 200] = (255, 0, 0)
pyl.imshow(p)
pyl.show()
--
Sincerely yours,
Yury V. Zaytsev
_______________________________________________
Image-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/image-sig