image for " histograms: libraw, dcraw, Capture NX-D"

AttachmentSize
Image icon histograms.png36.92 KB

Hopefully, the histogram images will post now...

Hi all,

I wish to convert raw .NEF files taken with a Nikon D40. I compared Nikon's Capture NX-D utility, libraw, and dcraw. First, I generated .tiff files with each of these. For NX-D, I converted without making any adjustments. With libraw, I used:

RawProcessor.imgdata.params.user_flip=0;
RawProcessor.imgdata.params.use_camera_wb=1;
RawProcessor.imgdata.params.output_color = 1;
RawProcessor.imgdata.params.no_auto_bright=1;
RawProcessor.imgdata.params.use_camera_matrix=0;
RawProcessor.imgdata.params.user_qual=3;
RawProcessor.imgdata.params.user_black=0;

for dcraw, I used:

dcraw -w -q 3 -T

I then loaded each converted tiff file into "The Gimp" to compare histograms. The histograms for the red channels are found in the attached image. The histograms for libraw and dcraw were very similar, however the dcraw histogram was shifted to the right relative to libraw. The Nikon NX-D historgram is quite different and appears to be have undergone a different transformation (color curve?) than the libraw and dcraw histograms. Also the libraw and dcraw histograms were missing discrete pixel values. Following are my questions:

1. I would like to get libraw to be as close as possible to the Nikon converter and was under the impression that dcraw used the actual (previously encrypted) color curves used by the Nikon converter. is this correct? Then why do the libraw (dcraw emulator) and dcraw histograms not match the Nikon NX-D histogram?
2. Why are the dcraw and libraw histograms missing values?
3. Why is the dcraw histogram shifted with respect to the libraw histogram?

Many thanks.

Forums: 

1. To get LibRaw as close as

1. To get LibRaw as close as possible to Nikon converter, you need to repeat Nikon converter in most important things: color profile, contrast curves, white balance data, color dithering.

2. output gamma curve (from 16 bit linear to 8-bit gamma) may have holes. Also, in deep shadows some values are missing because of linear sensor nature.

3. You've used no-auto-bright in LibRaw, but no corresponding switch (-W) for dcraw.
Also, if you wish to repeat dcraw as close as possible, set adjust_maximum_thr to 0.f

-- Alex Tutubalin

Yes, gamma correction is

Yes, gamma correction is applied on output. Internal Libraw/dcraw storage is linear, no tone curve applied.

-- Alex Tutubalin

This is ~2 year old comment.

This is ~2 year old comment.
For now, we know *WHY* Nikon does this: this is camera calibration to make white balance coefficients (presets) the same for all cameras (of given model)

-- Alex Tutubalin