alliedvision / VimbaPython

Old Allied Vision Vimba Python API. The successor to this API is VmbPy
BSD 2-Clause "Simplified" License
93 stars 40 forks source link

How to get BayerRG12 to .raw or .dng #151

Open phil333 opened 1 year ago

phil333 commented 1 year ago

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.

Teresa-AlliedVision commented 1 year ago

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.

phil333 commented 1 year ago

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.

Teresa-AlliedVision commented 1 year ago

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