VimbaPython icon indicating copy to clipboard operation
VimbaPython copied to clipboard

How to get BayerRG12 to .raw or .dng

Open phil333 opened this issue 2 years ago • 3 comments

Hello,

I am trying to write bayer images into a raw image file so that i can edit them in a photo editor like lightroom or darktable. Can someone suggest a workflow or library to do this.

phil333 avatar Mar 04 '23 19:03 phil333

Hello, I lost the code, but I had an example, where I debayered an image "by hand". In that case I converted the frame into a (probably NumPy) matrix and used the values like that to bring it into a format that I could display with openCV. Unfortunately I don't have any input on how to save the frame.

Teresa-AlliedVision avatar Mar 14 '23 11:03 Teresa-AlliedVision

opencv has a debayering function which works perfectly fine (cv2.COLOR_BayerRGGB2BGR). Saving the original data as numpy array would work too, but then i cannot open in a tool like lightroom or Rawtherapee. pidng is the closest to solving this problem, but somehow i can still not open these files it produces in rawtherapwee. And without some tools to edit the raw data, it is not really useful to keep the raw data.

phil333 avatar Mar 14 '23 18:03 phil333

I also didn't find a useful library either, I'm afraid. I just previously found the conversion to numPy array useful to avoid implicit debayering when displaying the pictures, because there is no pixel format attached and I could manipulate it into the format I wanted. But with your application this doen't help a lot. Unfortunately having the data as a pretty universal numpy array doesn't seem to make it easier to find a library to convert that into a .raw file. I'll update if I find something. RawPy seams to only read .raw files, not save them. Edit: Is imagIO an option? It supports dng. https://imageio.readthedocs.io/en/stable/formats/index.html

Teresa-AlliedVision avatar Mar 15 '23 09:03 Teresa-AlliedVision