How to create raw synthethic images

283 views Asked by At

I want to perform the color calibration of my camera. That's why I search demosaic algorithm, which can provide the closest color to color of a real object. That's why I want:

  • create synthetic images in OpenCV with known colors
  • mosaic it
  • pass it in an algorithm for estimation of efficiency

I use libraw for unpacking raw images and OpenCV for processing and storing them.

So, the question is, is there a library that can provide me different demosaic algorithms(i am ready to convert my synthetic image from Mat to C-style array) where I can pass my mosaic image and receive demosaic image. I think that it is possible to convert my image from tiff to dng and use RawTherapee for demosaicing, but it looks more complicated.

1

There are 1 answers

0
MegaMan On BEST ANSWER

I solved that problem by using dng sdk.

Pipeline for using class from link in the end of answer is here:

DngCreator creator;
cv::Mat mosaic = //some method that returns Bayer RGGB mosaic
creator.BuildDngImage(mosaic);
creator.setCameraProfile();
creator.setExifTags();
creator.setXmp();
creator.setMosaicInfo();
creator.WriteDng("output.dng");

As it can be seen i used opencv for creating mosaic images

There is source code with class DngCreator, which writes the simplest dng. I didn't make good dng with all needed tags, but RawTherapee red my dng successfully. The cite to code: https://pastebin.com/M4GRBfUG