I'm playing around with a camera for a microscope using Micro-Manager 1.4. Using the Python interface, I've managed to access the camera, change exposure time etc, and I can capture individual images.
However, each image is returned as NumPy arrays where each pixel is represented as a single integer, e.g. "7765869". As far as I can find online, this is known as a "BufferedImage" in Java, and it means that the RGB values are encoded as:
BufferedImage = R * 2^16 + G * 2^8 + B
My question is: How can I, using e.g. Numpy or OpenCV, convert this kind of array into a more handy array where each pixel is a RGB triplet of uint8 values? Needless to say, the conversion should be as efficient as possible.
a * x + b * y + c * z == n, where in our casea = 2**16, b = 2**8, c = 1. Typically, the solutions to these equations involve findinggcd(a, b, c)and hoping it dividesn; if it doesn't, then there are no solutions. Given that a solution exists, there are infinitely many solutions. However, we are restricted in this case to find a solution0 <= x, y, z < 256, so there will be only one solution given thatgcd(a, b, c) | n.