Tuesday, September 16, 2014

Tutorial: how to match the Nikon in-camera jpeg colors with photoflow

This tutorial will show you how to achieve a perfect color matching between the photoflow RAW processing and the in-camera Jpeg when reading Nikon NEF files. Or at least for D300 files, as this is the only camera I've carefully tested for the moment... However, I'm 90% sure that the method will give the same good results for other Nikon DSLR as well.

First of all, you will need to open a NEF file and add a RAW developer layer in order to process it; the details of how to do that can be found in my previous blog post, as well as the explanation of all the controls found in the RAW developer configuration dialog.

By defaul, photoflow interprets the linear RGB data of the RAW image using the standard Adobe color matrices, which give good and "correct" colors (possibly more "correct" than those produce by the camera).
Below I have put a first comparison between the result of Capture NX with the default in-camera settings, and photoflow with the in-camera WB and exposure and Adobe matrices for color rendering. Move your mouse pointer inside the image to see the photoflow version.


As you can see, the photoflow version lacks the "pop" of the in-camera image. Don't worry, we are going to fix that in few simple steps!


Step 1: extract the camera profiles from Capture NX(2) or View NX2

The final colors of the processed RAW image are determined by the input color profile. This profile, when combined with a suitable working profile, allows to "transforms" the linear RGB values from the camera into other RGB values that have a "well-defined" and camera-independent colorimeteric meaning.
Therefore, getting the "right colors" is mostly a question of using the "right camera profile". Fortunately for us, the Nikon software generates such profiles as temporary files whenever you open a RAW file for editing, so that w can save them for later use. There are several tutorials on the net that explain how to find those profiles on the hard drive; one good resource can be found on RawPedia.

One important detail to be kept in mind when creating the camera profiles using the Nikon software is that you need to switch off all enhancements, in particular the D-lightning if it was enabled in camera. Each time you do some changes that impact the camera color profile used internally by Capture/View NX, a new file will be created in the temporary folder; you should generally take the most recent one.

Different "Picture Control" settings will translate into different camera profiles: you can therefore create one profile for each of the settings (standard, portrait, landscape, neutral, etc.), and you will be able to mimic each of them in photoflow.


Step 2: load the profile in photoflow

Since we want to match the Jpeg image produced straight out of the camera, we should leave the WB mode to "CAMERA" and the exposure compensation to "0". Of course you are free to change those parameter if you are not satisfied with the result, but then your processing will obviously deviate from the in-camera image...

We now have to tell photoflow that it should use the Nikon camera profile to interpret the RAW image colors. To do that, you first have to open the RAW developer configuration dialog by double-clicking on the corresponding layer. Then go to the "Output" tab and change the "Color conversion mode" to "ICC". At this point, the preview window will most probably show a quite dark image: that's normal, since the camera profile is now undefined. Click on the "Open" button at the right of the "camera profile name" text entry, and select the Nikon profile in the file chooser dialog that will pop-up. At this the colors in the preview image should have changed, but still the image should appear very dark. This is because the Nikon color profile expects the RAW RGB values to be encoded with an sRGB tone curve instead of a linear one. The RAW developer dialog provides a drop-down selector, labelled "RAW gamma", which allows to choose the type of tone curve to be applied to the RAW data; three choices are provided:
1. "None": in this case the linear RAW data is not modified
2. "sRGB": an sRGB tone curve is applied to the linear RAW data
3. "Custom": a custom gamma curve is applied to the linear RAW data; you can set the slope of the gamma curve via the "Gamma exponent" value below the "RAW gamma" selector

As you might have already guessed, for Nikon profiles you have to choose option #2. Your RAW developer configuration dialog should look similar to this:


Et voila'! Your picture should now look exactly the same as the in-camera jpeg, at least in terms of colors. The image below shows a comparison between the result of Capture NX with the default in-camera settings and of photoflow using the Nikon profile and the sRGB tone curve (move your mouse pointer inside the image to see the photoflow version).
In fact, at this level the two pictures are indistinguishable!



Some soubtle difference appears if we look into the image at 100% scale. Below is a crop of the previous image, as usual you have to move the mouse into the image to see the photoflow version. The Capture NX version look a bit softer, even if I intentionally turned off any noise reduction. It seems that the open source Amaze demosaicing that is used by default in photoflow does really a good job in getting all the details out of the sensor data!

Now you can play with your preferred pictures using the nice and brigth original Nikon colors as a starting point...

2 comments:

  1. The link to RawPedia (which explains how to get the profile file) indicates the procedure works only with the previous version of viewnx2 (and therefore for the old models). Any suggestion for a d750 ?
    Thanks

    ReplyDelete