working with raw image files

kafooster dmozejko at gmail.com
Tue Jun 14 16:13:07 EDT 2011


Ok, I solved the problem with matplotlib

fileobj = open("hand.raw", 'rb')
data = numpy.fromfile(fileobj,dtype=np.uint16)
data = numpy.reshape(data,(96,470,352))
imshow(data[:,:,40],cmap='gray')
show()

the error was caused by different order of data, however it still
reads the dataset as half of it size. whatever.

please leave the part about .raw, lets just start thinking of it from
level of numpy array.

I would like to visualize this data with PIL, but PIL works only with
8bit data. How could I resample my array from 16bit to 8bit?



More information about the Python-list mailing list