Am Donnerstag, 31. Dezember 2020, 12:05:18 CET schrieb Sonali Warunjikar: > On Thu, Dec 31, 2020 at 02:15:33PM +0530, Sonali Warunjikar wrote: > > Now the USB layer is as such over. The challenge now shifts to the format > > of the data gathered. > > Almost there... > > The image resolution on Windows is known and the byte array gathered is > double of widthxheight indicating it's a 16 bit grayscale image and the > following way to build image using Pillow almost works - as in the shape > of the x rayed finger is fine.
That sounds terrific.
> > Image.frombytes('L',(1168,1562),buf,'raw','L;16B',0,1) > > Only problem left if I save it back as a raw bitmap (just to see how much > size a lossless format gives) it is of half the number of bytes gathered > from which it seems it's not using full 16 bit range. The X ray quality in > turn is affected. > > How to make Pillow consume all 16 bits per pixel is unclear. Whether L;16B > is right or not I am unsure.
This might be a limitation introduced by Pillow. I admit that I do not fully understand the problem but briefly looking up some references I came across
and
https://stackoverflow.com/questions/32622658/read-16-bit-png-image-file-using-python
I know that ImageJ is used a lot for Dicom images
maybe this helps. https://forum.image.sc/t/how-can-i-import-a-raw-image-in-imagej/36435
Other then that it migh be neccessary to decompile the Windows binary to get some pointers. |