Darktable Lens Correction for Nikon D500 + Kit lens 16-80 2.8-4E DX not working (lens not found) - How to fix it


(/ar) #1

Nikon D500 + AF-S DX Nikkor 16-80mm f/2.8-4E ED VR

With Fedora 27 and the latest darktable as of today (2.4.1), lens autodetection in the Lens Correction module fails (it can’t find the lens).

This method is for Linux / any distribution that ships lensfun >= 0.3 (Fedora 27 includes 0.3.2)

  • lensfun >= 0.3 comes with an utility that downloads the latest DB, run it:
    • lensfun-update-data
    • it will install a new copy of the db that overrides the default one, here: ~/.local/share/lensfun/updates/version_1/slr-nikon.xml
    • Customize it to fix the 16-80mm f/2.8-4E “lens not found” issue with the Lens Correction module
      • edit the above xml file, then search the original string below and change with the fixed one:
        • Original: <model>Nikon AF-S DX Nikkor 16-80mm f/2.8-4.0E ED VR</model>
        • Fixed: <model>Nikon AF-S DX Nikkor 16-80mm f/2.8-4E ED VR</model>

Finally, reload darktable, the issue should be gone and lens autodetection should now work. No need to reimport images nor delete existing sidecars xml files.

I advised the lensfun database maintainer so hopefully this change will be incorporated in future database releases.


(darix) #2
  1. what did you change exactly?
  2. did you run the script to update the lens fun database?

(Mica) #3

It’s 4 vs 4.0

I bet am older/newer version of this lens wrote a slightly different string to the exit data.


(/ar) #4

Exactly. Looks like the initial calibration was done with a 7200 (there is a comment in the database entry that mentions this) perhaps before the D500 release, and/or perhaps with an older camera firmware.

@darix yes, the first step is to run ‘lensfun-update-data’ to get a copy of the latest database installed in your home folder, that you can then easily edit.


(/ar) #5

As of July/2018, the process is now simpler since the latest lensfun include the change to their database.

Since Darktable still comes with an older database, you still need to run lensfun-update-data
In Fedora/28 this utility is included in the lensfun-tools package.
After running an update, the downloaded db update already includes the needed change.

Just restart darktable, and the lens correction will work out of the box for photos taken with this lens (D500 kit lens)


(darix) #6

darktable does not include the lensfun library. your distro does. you would need to ask them to update the lensfun data in the lensfun rpm.


(/ar) #7

That explains it :slight_smile:
In any case, it seems the updated database isn’t part of a release yet so likely all distros are impacted. Good thing is that it’s easier now