DNG to RGB Converter
Commercial Grade Digital cameras incorporate built-in image processing software that makes photographs look aesthetically pleasing to the human eye, but and introduce non-linearities and compression artifacts that hinder their use as scientific instruments. However, their image sensor originally produce linear outputs. Access to this linear data requires specific image processing which is detailed in this function.
Here we follow Rob Sumner's (2014) "Processing RAW Images in MATLAB" guide. The full document can be found here: http://www.rcsumner.net/raw_guide/RAWguide.pdf
Our implementation of the guide mimics the following workflow (that happens under-the-hood within the camera's built-in software). The function outputs all the intermediate image steps, including the original raw file and the camera settings.
Function:
[lin_srgb, lin_rgb, balanced_bayer, lin_bayer, raw, camSettings] = dng2rgb(imagename)
Inputs:
- imagename [string] = Original raw (DNG) file name (e.g. 'DSC_0001.dng')
Outputs:
- lin_srgb [nxmx3 double][0-1] = 16-bit, RGB image that has color corrected and exists in the right color space
- lin_rgb [nxmx3 double][0-1] = RGB image from balanced_bayer using demosaic()
- balanced_bayer [nxm double] [0-1] = White Balanced-linearized raw data (Bayer array)
- lin_bayer [nxm double] [0-1] = Linearized raw data with black level and saturation level corrected
- raw [nxm double] [0-1] = Raw data (Bayer array) from the camera's sensor
- camSettings [structure] = Contains camera settings used for convertion from RAW -> lin_srgb
Cite As
Rafael Villamor Lora (2024). DNG to RGB Converter (https://www.mathworks.com/matlabcentral/fileexchange/71420-dng-to-rgb-converter), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Image Processing and Computer Vision > Image Processing Toolbox > Import, Export, and Conversion > Image Sequences and Batch Processing >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |