Camera Support #10382

Please add Nikon D7200 support

Added by Ralf Brown about 5 years ago. Updated almost 5 years ago.

Start date:
Due date:
% Done:


Estimated time:
Affected Version:
git development version


Adding the following to src/external/rawspeed/data/cameras.xml and duplicating the line for Nikon D7100 in src/external/adobe_coeff.c for the D7200 allows the new camera's images to load:

        <Camera make="NIKON CORPORATION" model="NIKON D7200">
                <CFA width="2" height="2">
                        <Color x="0" y="0">RED</Color>
                        <Color x="1" y="0">GREEN</Color>
                        <Color x="0" y="1">GREEN</Color>
                        <Color x="1" y="1">BLUE</Color>
                <Crop x="0" y="0" width="0" height="0"/>
                <Sensor black="600" white="16383"/>
                        <Hint name="nikon_override_auto_black" value=""/>

The colors differ from those in the full-size JPEGs embedded inside the RAWs, but they're not wildly off.

DSF00097.nef (28.6 MB) DSF00097.nef QPcard201 calibration image for Nikon D7200 Ralf Brown, 03/23/2015 07:08 PM
DSF00097.nef.xmp (5.78 KB) DSF00097.nef.xmp History stack to export cropped image for ArgyllCMS Ralf Brown, 03/23/2015 07:08 PM
dt-noiseprofile-20150324.tar.gz (1.84 MB) dt-noiseprofile-20150324.tar.gz Ralf Brown, 03/25/2015 08:01 AM
dt-noiseprofile-20150329.tar.gz (3.58 MB) dt-noiseprofile-20150329.tar.gz Nikon D7200 noise profiles for all user-selectable ISOs from 100-25600 Ralf Brown, 03/30/2015 05:39 AM
tonecurve.pdf (456 KB) tonecurve.pdf Standard tonecurve graph Ralf Brown, 04/17/2015 08:10 AM
basecurve.pdf (865 KB) basecurve.pdf Standard basecurve graph Ralf Brown, 04/17/2015 08:10 AM
basecurve-8.pdf (865 KB) basecurve-8.pdf Base curve using 8-point spline Ralf Brown, 04/20/2015 04:03 AM


#1 Updated by Ralf Brown about 5 years ago

My new D7200 just arrived, so here are the white-balance presets extracted with I made a branch at last night, and will be adding these and other calibration settings there as time permits.

  { "NIKON", "D7200", "Incandescent", 0,        { 1.445313, 1, 2.667969, 0 } },
  { "NIKON", "D7200", "Cool WHT FL", 0,         { 2.222656, 1, 2.425781, 0 } },
  { "NIKON", "D7200", "Sodium Lamp", 0,         { 1.324219, 1, 2.90625, 0 } },
  { "NIKON", "D7200", "Warm WHT FL", 0,         { 1.476563, 1, 2.433594, 0 } },
  { "NIKON", "D7200", "White FL", 0,            { 1.746094, 1, 2.78125, 0 } },
  { "NIKON", "D7200", "Day White FL", 0,        { 2.246094, 1, 1.652344, 0 } },
  { "NIKON", "D7200", "Daylight FL", 0,         { 2.59375, 1, 1.308594, 0 } },
  { "NIKON", "D7200", "Mercury Lamp", 0,        { 3.171875, 1, 1.589844, 0 } },
  { "NIKON", "D7200", "Direct sunlight", 0,     { 2.394531, 1, 1.597656, 0 } },
  { "NIKON", "D7200", "Flash", 0,               { 2.738281, 1, 1.375, 0 } },
  { "NIKON", "D7200", "Cloudy", 0,              { 2.617188, 1, 1.449219, 0 } },
  { "NIKON", "D7200", "Shade", 0,               { 3.148438, 1, 1.289063, 0 } },
  { "NIKON", "D7200", "5000K", 0,               { 2.328125, 1, 1.65625, 0 } },
  { "NIKON", "D7200", "2500K", 0,               { 1.214844, 1, 3.390625, 0 } },
  { "NIKON", "D7200", "10000K", 0,              { 3.570313, 1, 1.207031, 0 } },

#2 Updated by Ralf Brown about 5 years ago

QPcard 201 image. As this card has relatively few color patches (and this particular copy has seen better days -- it's no longer flat, which has slightly darkened the three left-most patches), I'll be happy to defer to someone else with a better calibration image.

I'm also including a history stack, which I've verified creates an image that ArgyllCMS can evaluate (but turn off perspective correction [-p], as that got scanin confused).

No of test patches = 30
Find white & black points
Picked white patch 9 with dev = 0.878288 0.878717 0.880064
       XYZ = 0.818000 0.866000 0.910000, Lab = 94.568297 -3.255998 -16.018788
Picked black patch 4 with dev = 0.049412 0.050588 0.050015
       XYZ = 0.044000 0.046000 0.049000, Lab = 25.563355 -0.476819 -6.375028
Creating matrix...
Matrix = 0.574412 0.498708 -0.003005
         0.234821 0.981792 -0.113592
         0.017052 -0.128239 1.023113
Matrix = 0.574412 0.498708 -0.003005
         0.234821 0.981792 -0.113592
         0.017052 -0.128239 1.023113
Doing White point fine tune:
Before fine tune, rel WP = XYZ 0.940078 0.968989 0.802696, Lab 98.788299 1.018038 -0.278294
After fine tune, rel WP = XYZ 0.964200 1.000000 0.824900, Lab 100.000000 0.000000 -0.000000
                 abs WP = XYZ 0.797581 0.839053 0.885582, Lab 93.409343 -2.232270 -16.151847
Dev boundary white XYZ 0.907821 0.955082 1.006079, scale WP by 1.138286, total WP scale 1.138286
Black point XYZ = 0.045342 0.048138 0.050219, Lab = 26.197640 -1.412185 -5.923202
White point XYZ = 0.907875 0.955082 1.008046
Black point XYZ = 0.045342 0.048138 0.050219
Done gamma/shaper and matrix creation
Profile done
Profile check complete, peak err = 12.162670, avg err = 2.453795

#3 Updated by Roman Lebedev about 5 years ago

  • Priority changed from High to Low

#4 Updated by Ralf Brown about 5 years ago

  • % Done changed from 0 to 70
  • Status changed from New to Patch attached

See pull request #881.

#5 Updated by Pascal de Bruijn about 5 years ago

We need a few D7200 NEFs converted to DNG (of various ISOs) using Adobe's latest DNG converter to verify the color matrix (adobe_coeff).

#6 Updated by Ralf Brown about 5 years ago

Linux-only here, so someone else will need to provide the DNG conversion, though I'd be happy to supply the NEFs (I ran through the ISO scale in generating the white-balance coefficients, as I figured I might as well double-up and generate black frames at the same time).

#7 Updated by Ralf Brown about 5 years ago

Attaching noise profiles. The JSON has also been added to the pull request.

#8 Updated by Pascal de Bruijn about 5 years ago

I've added the wb_presets so they won't be forgotten.

That said, I just noticed that the latest DNG converter (8.8) doesn't support the D7200 yet. And we need that to verify correct operation. So adding support for the D7200 will have to wait.

Manually messing about in adobe_coeffs (in the meantime) does mean, your color output may shift (retroactively) in a future released version of darktable that will properly support the D7200. So do this at your own peril.

#9 Updated by Ralf Brown about 5 years ago

BTW, I added the wb_presets with +/-6 fine-tuning in a second commit in the PR:

> your color output may shift (retroactively) ... do this at your own peril.

Understood. It seems like the D7200 just missed inclusion in the 8.8 release.

#10 Updated by Pascal de Bruijn about 5 years ago

BTW, when taking guesses, I'd wager that the D7200 matrix will likely be the same as the D5500, but as I mentioned before, we'll need to wait before implementing official support:

{ "NIKON D7100",   0,      0, { 8322,-3112,-1047,-6367,14342,2179, -988,1638,6394 } },
 { "NIKON D5200",   0,      0, { 8322,-3112,-1047,-6367,14342,2179, -988,1638,6394 } },
 { "NIKON D5300", 600,      0, { 6988,-1384, -714,-5631,13410,2447,-1485,2204,7318 } },
 { "NIKON D5500", 600, 0x3e14, { 8821,-2938, -785,-4178,12142,2287, -824,1651,6860 } },

#11 Updated by Ralf Brown about 5 years ago

I wouldn't bet against your wager, though of course none of the camera matrices (D7100, D5300, D5500, my own) exactly match the OOC JPEG hues, not that that was a surprise. All four of those matrices also show substantially more saturated reds and yellows than OOC -- I have to desaturate by around 20% to get a visual match on saturation.

#12 Updated by Ralf Brown about 5 years ago

I've replaced pull request #881 with the new PR #885. This should clean up the problems I caused with the old PR when I previously tried to resync it with the main project.

The new PR uses the D5500 color matrix for the standard color matrix, and I've updated the noise profiles and added profiles for additional ISO values.

#13 Updated by Pascal de Bruijn about 5 years ago

Looking at:

Please add firmware version as a comment
darktable doesn't interpolate between finetuning values, so please do add all the intermediate ones, I will pull without them, as ufraw does interpolate (and they get new wb_presets via us, as well as we get them from them).
With regard to the kelvin values, we're mostly interested in 2700K/5000K/5500K/6500K

@enhanced matrix:
please drop it, I'm not confident enough in the QPcard to add anything resulting from it directly into darktable upstream. You're free to keep using it yourself of course. (for adding an enhanced matrix I'd highly prefer something calculated from a ColorChecker or IT8 chart).

at this point we're mostly interested in the cameras default out-of-the-box curve (Standard??? with Active D-light disabled). Please drop the others from the pull request. Here again, you're free to continue using the other ones for personal use.
also, am I right that you generated these curve using 16 curve points, often that seems to introduce invalid details and thus unsmooth curves. With some experimentation other users seem to report that 8 curve point often gives best results (IIRC).

With above taken care of, I'll consider pulling, and disabling the D7200 by default in cameras.xml for the time being. At least that way switching it off/on for testing will be a bit more convenient.

#14 Updated by Ralf Brown about 5 years ago

Will do on the WB presets, though I won't get to it until the weekend.

I agree that the QPcard matrix I generated isn't good enough (it seems to shift purples toward blue). Do I need to revert that commit, or can you just cherry-pick around it?

The base/tone curves I marked as "(Standard)" are the default curves with Active D-light disabled (none of the four have it enabled). They are indeed 16-point curves, but look nice and smooth on the generated graphs -- I used multiple photos to get good coverage of all luminance values.

Is there any strong reason not to give users a choice of the various base/tone curves available in the camera? They only appear in the dropdown if the camera matches, so it's not like they are cluttering up the interface for everyone.

#15 Updated by Pascal de Bruijn about 5 years ago

@enhanced matrix, I don't think I can cherrypick from forked copies of our tree.

As for the curves, basically a tool was made, but no real efforts were invested in actually creating a standard for what should be included into darktable and what not. Nor is there a standard for evaluating an resulting curve's quality. And I wouldn't be surprised if some of the curves already in darktable aren't of the quality level I'd like them all to be. And at some point we might remove some of them.

Going back to what the curves actually do is simulate tonality/contrast (but not color rendition). Where the main goal is to more-or-less approach camera default output as our default output. Providing curves that specifically reference picture styles (or whatever they are called for Nikon) sortof implies that our output would closely mimic that picture style, which for many users would imply color rendition as well, which isn't easily feasible. So including more curves is sortof quasi-misleading depending on your imaging knowledge level. And that's a situation I'd like to avoid.

As for curve smoothness, they are fairly smooth indeed, (I've seen much worse), but there is some wobble in there, that likely shouldn't really be there. So I'd really like to see a version with less curve point, as I said, generally speaking I got the impression that 8 points should be enough for most cases (less curve points generally don't seem to work too well either for auto-generated curves.

#16 Updated by Ralf Brown about 5 years ago

I assume by "wobble" you mean that the red curve for the spline fit is sometimes above and sometimes below the green line for measured values. The fix for that is usually more points, not fewer. An eight-point spline clearly deviates more than the 16-point (especially in the extreme highlights), while an 18-point curve matches the toe of the graph exactly even viewed at 700%, unlike the 16-point or 8-point curves. I tried a 20-point curve as well, but the fitted base curve did not run from (0,0) to (1,1); the 20-point tone curve did, so I included it in tonecurve.c.

I've made all the other changes you requested, choosing to comment out the additional curves rather than removing them entirely.

#17 Updated by Pedro Côrte-Real about 5 years ago

The basic support for the camera is now enabled in master with this commit:

The camera seems to use the same matrix as the D7100. I see the WB presets are already in so the basic support is done. We may still want to get the matrix/curve/noise profile though.

#18 Updated by Ralf Brown about 5 years ago

Curves and noise profiles are there for the taking in PR #885, though I'll need to update my branch for you to do more than cherry-pick individual commits since some of the other updates in darktable-master conflict with the older version from which the branch originated.

#19 Updated by Marcel Dausend about 5 years ago

Up to now, darktable (build from the master branch) does not extract the correct colors from the D7200 raw files (cf. attachment).

Pascal de Bruijn wrote:

We need a few D7200 NEFs converted to DNG (of various ISOs) using Adobe's latest DNG converter to verify the color matrix (adobe_coeff).

Do you still need sample raw files from the Nikon D7200? If this is the case, how should I send you the data. Do you require any special kind of photos and/or a specific scene setup?
If you need some samples, please let me know.

Kind regards,

#20 Updated by Pascal de Bruijn about 5 years ago

  • % Done changed from 70 to 100
  • Status changed from Patch attached to Fixed

As pedrocr's commit references, we don't need DNGs anymore.

Everything relevant should be available in 1.6.x and master now.

#21 Updated by Marcel Dausend about 5 years ago

Dear Pascal,

thank you. 14bit raw files seem to work. But I am sorry to report that 12bit raw files from the D7200 are still not imported correctly.

Kind regards

#22 Updated by Pascal de Bruijn almost 5 years ago

  • % Done changed from 100 to 50
  • Status changed from Fixed to In Progress

Without a sample there isn't much we can do.

#23 Updated by Pascal de Bruijn almost 5 years ago

Any 12bit NEF should be fine (image content doesn't matter too much, preferably just some random outdoors shot.

Current uploads in our Redmine seem to be broken, so any file hosting service that doesn't require us to "login" or fill out our "email" should do.

#24 Updated by Pascal de Bruijn almost 5 years ago

  • % Done changed from 50 to 100
  • Status changed from In Progress to Fixed

Samples were delivered out of band.

12 bit support was added, and will likely be present in our imminent 1.6.7 release:

PS: Please consider uploading both a 14bit and 12bit sample to

#25 Updated by Ralf Brown almost 5 years ago

I just discovered that the current version of master doesn't include the noise profiles I contributed (see PR #885). Is there a problem with them?

#26 Updated by Ralf Brown almost 5 years ago

Thanks for merging in the noise profiles, but there's one minor change needed. As-is, the profiles won't show up, because the model naming in noiseprofiles.json has changed since I made the commit that got merged into master (I pushed the change on my branch at the time of my previous note, but it didn't show up in the pull request, presumably because it had been closed).

You need to change
"model": "NIKON D7200",
"model": "D7200",

Also available in: Atom PDF

Go to top