Add Camera Support (Nikon P7000) to dcraw (and libraw)

I bought a Nikon Coolpix P7000 a while ago. One reason for choosing that model was that it can produce RAW images. Well, only Nikons ViewNX software supports it. No luck with iPhoto, no luck under Linux. So I decided to see what I could do myself and started checking out the source of dcraw. The author was very helpful but couldnt provide a “color matrix” (without the camera, or a particular picture taken with the camera). Now I have calculated a reasonably good color matrix myself.

A few notes:

  1. Determining a color matrix is tricky, and not a completely objective business. Please see this separate post about finding the color matrix, in case you dont trust it or like it.
  2. A little trick was needed for ISO400 and above, please see separate post
  3. The patch is not written for libraw, but with little skills you will be able to apply it to the file interal/dcraw_common.cpp in libraw sources

The effect of the patch is displayed by these pictures:

  • Upper left: no patch applied
  • Upper right: patch with no color matrix
  • Lower left: full patch, with my color matrix
  • Lower right: picture as camera exports it to JPG

Well, some brightness and auto-white-balance (-b 1.4 -a) and we have:

Maybe an even better color matrix can be found, but right now I feel that the ISO400 problem mentioned above is more important.

Now the dcraw patch (for version 9.04):

*** dcraw.c	2010-11-09 17:17:22.162772794 +0100
--- dcraw-new2.c	2010-11-14 18:41:24.802772823 +0100
***************
*** 6367,6372 ****
--- 6367,6374 ----
  	{ 7971,-2314,-913,-8451,15762,2894,-1442,1520,7610 } },
      { "NIKON COOLPIX P6000", 0, 0,
  	{ 9698,-3367,-914,-4706,12584,2368,-837,968,5801 } },
+     { "NIKON COOLPIX P7000", 0, 0,
+ 	{ 7177, -1363, -1257, -1529, 7422, 839, -795, 1563, 2398 } },
      { "OLYMPUS C5050", 0, 0,
  	{ 10508,-3124,-1273,-6079,14294,1901,-1653,2306,6237 } },
      { "OLYMPUS C5060", 0, 0,
***************
*** 7248,7253 ****
--- 7250,7261 ----
    } else if (!strcmp(model,"COOLPIX P6000")) {
      load_flags = 24;
      filters = 0x94949494;
+   } else if (!strcmp(model,"COOLPIX P7000")) {
+     load_flags = 24;
+     filters = 0x94949494;
+     if (iso_speed >= 400) {
+       black = 256;
+     }
    } else if (fsize == 1581060) {
      height = 963;
      width = 1287;
  1. dcraw revision 1.442 has a color matrix for P7000 defined, which I think could be correct:

    { “NIKON COOLPIX P7000”, 0, 0,
    { 11432,-3679,-1111,-3169,11239,2202,-791,1380,4455 } },

    But the other patch with iso_speed is not yet included in dcraw.

  2. Perhaps the ISO-speed fix was not 100% and somebody preferred to have a simple broken solution, rather than a slightly more complicated solution that is still broken. I think I have imported pictures with the fix applied, that still did not get correct. I have no influence over dcraw or derived dcraw-libraries.

    Maybe I will investigate when I have time.

    Thanks for your comment!

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trackbacks and Pingbacks: