Add new comment

Reproduce RawDigger result with LibRaw

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.

Forums: