On 14/06/2011 22:20, kafooster wrote:
On 14 Cze, 22:26, MRAB<pyt...@mrabarnett.plus.com>  wrote:

Multiply the numpy array by a scaling factor, which is
float(max_8bit_value) / float(max_16bit_value).

could you please explain it a little? I dont understand it. like
multiplying each element?

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()
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to