Wednesday, 22 July 2015

How can I convert a proprietary raw image format to Adobe DNG?


I have a proprietary raw camera image format taken from a Aptina camera.


Its raw file format is 16bit per color channel, 'GRBG' mode with file extension .raw. No headers, nothing, just plan raw bayer samples. I want to convert this format to DNG, as none of the raw image decoders (dcraw, gimp, …) seem to support it.





  1. Is there any tool/converter which can handle Aptina camera sensor raw bayer format, and allow me to convert it to DNG format?




  2. If not, I want to write a small C code to convert it myself. Where can I find the detailed specification about DNG format, its structure etc.? Any document explaining all this DNG format?





Answer



DNG files are based on the TIFF/EP standard, ISO 12234-2, (they're essentially bitmaps with extra metadata) so if you start out with an appropriate TIFF I/O library that will get you part way, but you'll need to fill in the extra data required by DNG, which could be tricky.


Raw converters need to know more than just the pixel intensities. Other relevant information includes pixel shape and orientation, or the properties of the dyes (just knowing they go GRBG is not enough, you may need to know the precise shade (or more accurately the frequency response) of each dye to create the colour representation as this varies between manufacturers). I think DNGs handle this by means of an embedded "camera profile".



edit:


There's an open source photo management application called digiKam which can write DNG files, so your best bet would probably be to look through their source and try and rip out the DNG encoding functions.


No comments:

Post a Comment

Why is the front element of a telephoto lens larger than a wide angle lens?

A wide angle lens has a wide angle of view, therefore it would make sense that the front of the lens would also be wide. A telephoto lens ha...