On 15/06/2011 00:59, kafooster wrote:
On 15 Cze, 00:06, MRAB<pyt...@mrabarnett.plus.com>  wrote:


Yes. Something like this:

fileobj = open("hand.raw", 'rb')
data = numpy.fromfile(fileobj, dtype=numpy.uint16)
fileobj.close()
data = data * float(0xFF) / float(0xFFFF)
data = numpy.array(data, dtype=numpy.uint8)
data = data.reshape((96, 470, 352))
imshow(data[:, :, 40], cmap='gray')
show()

thank you very much, it works and now I can display this data even
with Image.fromarray(). As I understand, it  multiplies data elements
by a fraction, so that when we have less levels (in 8uint), it can fit
there?

Correct.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to