Hi, I'm trying to use LibRaw to process a DNG file, with the bare minimum of processing. I've got the image in RawDigger, and I'd like to reproduce it with LibRaw.
At the moment, the LibRaw colours are too dark, compared with RawDigger.
I can get them to match if, in RawDigger, I set the "Camera color profile" to "no profile" (compared with the built-in profile).
So, I'm thinking LibRaw is not using the built-in profile correctly.
Here's some of my code:
LibRaw iProcessor; iProcessor.imgdata.params.use_camera_matrix = 1; iProcessor.imgdata.params.use_auto_wb = 0; iProcessor.imgdata.params.use_camera_wb = 1; iProcessor.imgdata.params.no_auto_bright = 1; iProcessor.imgdata.params.no_auto_scale = 0; // Open the file and read the metadata iProcessor.open_file(file); // The metadata are accessible through data fields of the class printf("Image size: %d x %d\n",iProcessor.imgdata.sizes.width,iProcessor.imgdata.sizes.height); // Let us unpack the image iProcessor.unpack(); // Convert from imgdata.rawdata to imgdata.image: // iProcessor.raw2image(); iProcessor.dcraw_process(); // And let us print its dump; the data are accessible through data fields of the class int i; for(i = 0;i < iProcessor.imgdata.sizes.iwidth * iProcessor.imgdata.sizes.iheight; i++) { printf("i=%d R=%d G=%d B=%d G2=%d\n", i, iProcessor.imgdata.image[i][0], iProcessor.imgdata.image[i][1], iProcessor.imgdata.image[i][2], iProcessor.imgdata.image[i][3] ); break; } char outfn[1024]; snprintf(outfn, sizeof(outfn), "%s.%s", "/Users/paul/data/raw_test/out", "tiff"); cout << outfn << endl; int ret; if (LIBRAW_SUCCESS != (ret = iProcessor.dcraw_ppm_tiff_writer(outfn))) fprintf(stderr, "Cannot write %s: %s\n", outfn, libraw_strerror(ret)); // Finally, let us free the image processor for work with the next image iProcessor.recycle();
Any ideas would be much appreciated!
Thanks.
1) RawDigger uses LibRaw
1) RawDigger uses LibRaw postprocessing code
2) RawDigger's default is no_auto_bright = 0
-- Alex Tutubalin @LibRaw LLC
Thanks for your response!
Thanks for your response!
Yes, I thought RawDigger used LibRaw.
I set no_auto_bright = 0, and it didn't really change the result. The LibRaw output is still much darker than the RawDigger output.
Are there any other settings I should be changing in LibRaw?
(Again, I suspect LibRaw is not using the DNG color matrix, but I'm not sure...)
By default, LibRaw *uses* DNG
By default, LibRaw *uses* DNG color matrix, quote from docs:
1 (default): use embedded color profile (if present) for DNG files (always); for other files only if use_camera_wb is set;
RawDigger settings are different:
0 for 'built-int color profile'
3 for 'Embedded in RAW'
-- Alex Tutubalin @LibRaw LLC