On Tue, 14 Jun 2011 13:13:07 -0700, kafooster wrote: > 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?
Why bother? NumPy is a much better image-processing library than PIL. The only reason I use PIL is for its import/export routines. If you are going to use PIL, apply any corrections (gamma correction, histogram equalisation, etc) before reducing the data to 8 bits. -- http://mail.python.org/mailman/listinfo/python-list