Lens Correction not working

Since updating darktable to 3.2.1 I’ve noticed Lens Correction module is not working. Clicking the power button on and off does nothing. As per attached screenshot, it clearly inputs camera and lens, but says ‘camera/lens not found’ right underneath. I notice there have been similar threads about this on past updates, but they are all for Linux, and I am on Mac 10.12.6 How do I fix this?
Many thanks

dt 3.2.1, Ubuntu 18.04
Can not reproduce. Tried with two different lenses, with old edits an with fresh imported images. Lenses are recognized correctly, lens correction module is auto-applied where it should, on/off button of the module is working as expected.
Probably updating lensfun database could help (lensfun-update-data). Is it possible to select a lens from the dropdown menu ?

Yes can select lenses from drop down menu, and auto apply, yet right underneath it says ‘camera/lens not found’. You can see it there in the screen shot. Does it on both old and new edits. How do I update lens database on mac?

Edit: appears to be working on some files and not on others. Not sure now if its because those files simply need no correction? Anyone who worked on the following playraw’s might be able to confirm, whether lens correction makes a difference or not:
butterfly: Less effort needed in dt 3.2.1 to get a better image than the embedded JPEG. What do others do? - #10 by Tim
bucket-wheel excavator: [PlayRaw] Bucket-wheel Excavator - #15 by Soupy

See How to update lensfun in darktable 3 for Mac?

No, AFAIK dt never automatically decides for you if to apply the module or not. The module is auto-applied only if you defined a preset which tells dt to do so.
Did you check the name of the lens for the files working and those not ? You can use exiftool for this task. Check every single character !

Unfortunately reading the answer there is a bit like reading Greek to me. I can confirm this folder exists, full of xml’s. /Applications/darktable.app/Contents/Resources/share/lensfun/version_1

Is this correct… I download macports and type in lensfun-update-data. This will give me some files, which I then copy into one of the above folders?

I didn’t mean auto apply, I meant whether the correction was visually obvious.

I checked the names of two files that weren’t working, comparing the lens correction drop downs to the image information in darktable. Both had matching characters.

Appreciate the help.

Sorry, I’m not a mac user, so I don’t know the exact procedure on this OS. But I’m shure you will find several instructions if you search the web for keywords like update lensfun database mac. And possibly the lensfun website may help https://lensfun.github.io/ , or one of the mac users here.

first step: use the drop down list to check if the lens is available in the lensfun database (no need to look somewhere around in the world)
If it’s available then maybe the spelling is different.
Then you have to help exiv2 to identify it the correct way (as it is identified in lensfun).
to do this have a look at Exiv2/exiv2#1192 (comment)

I noticed a problem with my Sony A7R4 and 100-400mm lens, it complained my camera and lens wasn’t detected. Selecting them manually worked. My Canon Kiss-M with 15-45 kit lens was automatically detected. I’ll need to look into why I had an issue with my Sony, but it will normally be an issue with lensfun/exiv2 rather than darktable itself… (I’m using Manjaro Linux, but Mac OSX is likely to behave the same)

Ok it appears the lenses are not in the database. Checked on three images that weren’t working. Went to select manually from the drop down and couldn’t find them. I assumed when the camera and lens displayed in the drop down box that they must exist in the drop down menu - but its not the case. Thanks all for the replies.

In my case, I see I was using a Teleconverter with the 100-400mm, which changed the name in the EXIV data in the raw file, and that’s why it wasn’t picked up. I don’t think I can use that correction profile, because it is designed to correct the lens without teleconverter. If I want to do corrections in darktable, I’ll think I’ll need to profile the lens+teleconverter together… :-/

the lens from the original post is in lensfun slr-sigma.xml:

<lens>
        <maker>Sigma</maker>
        <model>Sigma 150-600mm f/5-6.3 DG OS HSM | C</model>
        <mount>Canon EF</mount>
        <mount>Sigma SA</mount>
        <mount>Nikon F AF</mount>
        <cropfactor>1.613</cropfactor>
        <calibration>
            <!-- Taken with Canon EOS 80D -->

but it’s identified in exiv2 with a different name (as you can see it in darktable) So you need the exiv2 tweak to override the identification.

1 Like

Ok, my lens is in the database, but it is not identified exactly the same way darktable gets it from the image file.

Image file: “Nikon AF-S DX VR Zoom-Nikkor 55-200mm f/4-5.6G IF-ED”

lensfun database: “Nikon AF-S DX Zoom-Nikkor 55-200mm f/4-5.6G ED”

The difference is the “IF-” before the “ED”. I’m not sure what to do to “fix” this. The image files will probably always report the same string. But if I fix it in the database, manually, it will be overlaid every time the database is updated. On my system, the database was last updated on May 16, 2020, so it appears to be a fairly common occurrence.

However, as a one time shot, I edited the lensfun database for that one entry. I restarted darktable, and loaded the lens correction module. It still says it is not found.

@Soupy you need to make an exiv2 config file that maps the number onto the correct lens name, see: Update request: Sigma 35mm F1.4 DG HSM ART Canon Mount · Issue #1192 · Exiv2/exiv2 · GitHub

1 Like

Darktable uses exiv2 to extract the name of the lens. At least for canon mount it‘s done via a specific id as shown in my linked post. This is hardcoded in the exiv2 library but can be overridden using the ~/.exiv2 file.
You can determine the id via

exiv2 -pv --grep lens/i <file>

Maybe it’s not exactly the same for nikon mount, but similar.
Have a look at Lens not automatically selected - #10 by sotsoguk Theres a nikon lens used

1 Like

Its the same for Nikon, a numeric value is mapped to a lens name.

1 Like

I’m pretty shure that a nikon mount lens is not identified as

0x0016 CanonCs      LensType          Short       1  368

:wink:

My Arch Linux system does not have a ~/.exiv file or directory.

PS - Oh, wait, @paperdigits said you have to create it.

PPS - Perusing “man exiv2”. Head spinning.

Metadata detection and interpretation is a hard problem :wink:

1 Like

Sadly, until recently that has been the case. Here’s the exiftool list of all the Lens* tags in a NEF from my D7000, -n for the raw metadata:

glenn@caliente:~/Photography/rawproc$ exiftool -n -G -Lens*  DSG_3111.NEF
[MakerNotes]    Lens Type                       : 14
[MakerNotes]    Lens                            : 18 200 3.5 5.6
[MakerNotes]    Lens Data Version               : 0204
[MakerNotes]    Lens ID Number                  : 139
[MakerNotes]    Lens F Stops                    : 5.33333333333333
[Composite]     Lens ID                         : 8B 40 2D 80 2C 3C FD 0E
[Composite]     Lens Spec                       : 18 200 3.5 5.6 14

The nice nomenclature you see from exiftool when you don’t use -n are exiftool lookups to internal tables. Just to hurt your head even more, that [Composite]LensID is an amalgam of eight other metadata values that is then looked up in a table that is AFAIK no longer maintained in a single place.

More recent Nikon cameras exhibit an apparent epiphany in playing nice, here’s the same for my Z6:

glenn@caliente:~/Photography/rawproc$ exiftool -n -G -Lens*  DSZ_4168.NEF
[MakerNotes]    Lens Type                       : 0
[MakerNotes]    Lens                            : 24 70 4 4
[MakerNotes]    Lens F Stops                    : 5
[MakerNotes]    Lens Data Version               : 0800
[MakerNotes]    Lens ID                         : 1
[EXIF]          Lens Info                       : 24 70 4 4
[EXIF]          Lens Make                       : NIKON
[EXIF]          Lens Model                      : NIKKOR Z 24-70mm f/4 S
[EXIF]          Lens Serial Number              : 20078247
[Composite]     Lens Spec                       : 24 70 4 4 0

They are now actually populating the the standard LensModel EXIF tag with a nice complete string…