I am working with some raw camera data (BayerRG8 or BayerRG12) that is coming straight from a camera (Allied vision). I can access it as a numpy array of shape (1216,1936,1) at a bitdepth of <class 'numpy.uint8'> or <class 'numpy.uint16'>. To get useful images out of this, I use the cv2 function: cv2.cvtColor(frame, cv2.COLOR_BayerRGGB2BGR)
.
My issue is that I would like to keep the raw data from the images and save them to disk as .raw or .cr2 file, so that I can edit them in something like Lightroom or Darktable. Can someone recommend a library to achieve this?