BayerToRGB and higher bit depths

I am trying to use an image with > 8 bits per pixel and channel in the Foundation Package’s BayerToRGB tool, but the output is always a 24 bit RGB image. Am I doing something wrong or is this a restriction of the tool?

While :cvb: BayerToRGB is in principle able to work on input images with up to 16 bits per pixel component, the calculation will always be carried out on 8 bit data and will always yield 8 bit data. In other words: There is no advantage to be gained from feeding images with more than 8 bits per pixel to BayerToRGB, and the result image will always be in RGB24 format.

Ok, that explains it. It’s a bit of a pity that the camera doesn’t do the conversion internally already - this would save processing time and it could instead work on images with more than 8 bits to reduce computation artefacts :rolling_eyes:

In principle you are right, but there are also solid reasons sometimes that manufacturers don’t do the conversion inside the camera. I have no idea what model you are using, but consider GigE Vision for example: With a camera delivering RGB24 pixels at e.g. 5 MPixels each frame needs 15 MB of the available bandwidth, capping the maximum possible frame rate at around 6.5 MB under the best of circumstances (unless you can use features like TurboDrive or Link Aggregation). If the camera transmits the raw Bayer pattern instead, the max. achievable frame rate is three times higher (20 fps in this example). The cost for this is the extra effort the PC has to make once the frames have arrived for converting to RGB24 (which in the case of the by the way the driver can do transparently without you having to code for this, but admittedly the conversion results of the don’t look as pleasant as those of the :cvb: BayerToRGB tool…