Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

From the cheat sheet:

SDK Supported

  • Camera Tool Source Code in C#
  • Capture & Display
  • OpenCV supported through Emgu
  • RAW to RGB Conversion
  • Save file as BMP & RAW format
  • Color matrix

The image you posted ressembles a lot to the green "RAW" image from the cheat sheet, so what you are doing seems to be OK.

So just use the SDK to convert the RAW image to RGB, then you can continue with OpenCV.

The only inconvenience is that according to the cheat sheet, the SDK is using C# (and the Emgu C# wrapper for OpenCV), not C++. If you prefer C++, you can try to port the RAW->RGB conversion routine from C#, as the SDK is open-source.

This solution has the advantage that you can try to to convert the 12 bit image to 16 bits (CV_16UC3), not losing the additional color depth resolution (however I would suggest to pass to 8 bits/channel, as it should be more than enough to most applications; the images will be smaller, the processing faster, and most OpenCV routines take 8 bit images).

From the cheat sheet:

SDK Supported

  • Camera Tool Source Code in C#
  • Capture & Display
  • OpenCV supported through Emgu
  • RAW to RGB Conversion
  • Save file as BMP & RAW format
  • Color matrix

The image you posted ressembles a lot to the green "RAW" image from the cheat sheet, so what you are doing seems to be OK.

So just use the SDK to convert the RAW image to RGB, then you can continue with OpenCV.

The only inconvenience is that according to the cheat sheet, the SDK is using C# (and the Emgu C# wrapper for OpenCV), not C++. If you prefer C++, you can try to port the RAW->RGB conversion routine from C#, as the SDK is open-source.

This solution has the advantage that you can try to to convert the 12 bit image to 16 bits (CV_16UC3), not losing the additional color depth resolution (however I would suggest to pass to 8 bits/channel, as it should be more than enough to most applications; the images will be smaller, the processing faster, and most OpenCV routines take 8 bit images).

[EDIT] Take a look at this open source driver for Leopard Imaging cameras - with C++/OpenCV support. It contains also the RAW (Bayer) -> RGB conversion function.

From the cheat sheet:

SDK Supported

  • Camera Tool Source Code in C#
  • Capture & Display
  • OpenCV supported through Emgu
  • RAW to RGB Conversion
  • Save file as BMP & RAW format
  • Color matrix

The image you posted ressembles a lot to the green "RAW" image from the cheat sheet, so what you are doing seems to be OK.

So just use the SDK to convert the RAW image to RGB, then you can continue with OpenCV.

The only inconvenience is that according to the cheat sheet, the SDK is using C# (and the Emgu C# wrapper for OpenCV), not C++. If you prefer C++, you can try to port the RAW->RGB conversion routine from C#, as the SDK is open-source.

This solution has the advantage that you can try to to convert the 12 bit image to 16 bits (CV_16UC3), not losing the additional color depth resolution (however I would suggest to pass to 8 bits/channel, as it should be more than enough to most applications; the images will be smaller, the processing faster, and most OpenCV routines take 8 bit images).

[EDIT] Take a look at this open source driver for Leopard Imaging cameras - with C++/OpenCV C++/OpenCV support. Maybe it will need modifications, as it was written for USB30-M021 cameras. It contains also the RAW (Bayer) -> RGB conversion function.