I am working with a 12bit monochrome camera. It can do 8bit but I need the extra bits of data for some calculation around certain pixels. So I am using the camera generating a 16 bit grayscale TIFF file (the only way to get the 12 bit of data that I need).
the content of each pixel (per manufacturer) is: 11111111 1111XXXX - white 00000000 0000XXXX - black
where X is random (again per manufacturer).
the file doesn't look as if the last 4 bits are random but that's another matter (out of topic).
What I am trying to do is open that file, read the pixel value (first 12 bits) for a given pixel (say X, Y).
I looked online but all I could find were projects that will read the all 16 bits...
edit: I was able to directly read the camera buffer which gives me access to the whole 16 bits. I end up with a UInt16 which I need to transform into a 12 bit number.