imagematlabtifflightroomdng

How to convert a matrix containing a non-demosaiced image to a RAW image file, openable by Lightroom?


I have a camera module, from which I am reading out "RAW", non-demosaiced image data (this camera module uses a Bayer BGGR filter). I am currently storing this in a MATLAB matrix. I am aware that MATLAB can demosaic this image for me, but I would like to use Adobe Lightroom's demosaicing algorithm and processing tools.

Do any tools exist to convert this matrix (using MATLAB or otherwise) into a standard RAW file, such as Adobe's DNG format? I understand that DNG is very similar to TIFF, can this be leveraged?


Solution

  • As I know, you can use the Adobe DNG SDK. Download Adobe DNG SDK from here.

    1. Adboe DNG SDK can read dng format and save dng as tif format.
    2. If you want to read bayer format( non-demosaiced image data ), you can try to hack Adobe DNG SDK. Replace of bayer data before demosaic.

    Something need to notice.

    1. You must use correct "bayer type"( BGGR , RGGB.. etc ).

    2. You must use correct "bits per sample".

    3. You must use correct "width" and "height".