0

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?

Phil333
  • 19
  • 1
  • 7
  • For 8 bit bayer - you can treat as if it was grayscale and use opencv to save as bmp. – wohlstad Mar 04 '23 at 18:04
  • 1
    IIRC Photoshop and most likely Lightroom can use TIFF files as raw - I mean they can open them into their *"Raw converter"* interface. Also, TIFFs can store 12/14/16/32 bit data losslessly. OpenCV can write TIFFs, so can `tifffile` on PyPI. – Mark Setchell Mar 04 '23 at 18:08
  • Oh, I see you want to retain RGGB bayer format - that may not work as you are hoping. Maybe 16-bit RGB is good enough if it still goes into the *"Raw converter"*. – Mark Setchell Mar 04 '23 at 18:12
  • @MarkSetchell saving to a 16bit tiff or other format is indeed feasible, but not what I am looking for. The de-bayering process cannot be reversed, and this means modifying the color temperature and tint is not possible to the same extend. – Phil333 Mar 06 '23 at 17:18
  • @wohlstad Saving the raw data as bmp or even numpy array would also work, but leaves me without any tools to edit the pictures. – Phil333 Mar 06 '23 at 17:18

0 Answers0