darktable icon indicating copy to clipboard operation
darktable copied to clipboard

lens correction: lens not detected depending on lens name

Open MStraeten opened this issue 2 years ago • 4 comments

Describe the bug

situation: i created lens correction data for Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x and added them to local lensfun database: slr-canon.xml:

...
    <lens>
        <maker>Canon</maker>
        <model>Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x</model>
        <model lang="en">Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x</model>
        <model lang="de">Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x</model>
        <mount>Canon EF</mount>
        <cropfactor>1</cropfactor>
        <calibration>
            <distortion model="ptlens" focal="140" a="-0.018543" b="0.0512283" c="-0.0572633"/>
            <distortion model="ptlens" focal="189" a="-0.0083338" b="0.0157056" c="-0.0149411"/>
            <distortion model="ptlens" focal="280" a="-0.0084512" b="0.0161198" c="-0.0117873"/>
            <distortion model="ptlens" focal="420" a="-0.0069125" b="0.0173189" c="-0.0211893"/>
            <distortion model="ptlens" focal="560" a="-0.0047086" b="0.0120691" c="-0.0208262"/>
        </calibration>
    </lens>
...

exiv2 -pa --grep lens/i identifies it quite ok:

exiv2 -pa --grep lens/i  ~/Pictures/Import_20230723/20230722-IMG_0416.CR3
Exif.Photo.LensSpecification                 Rational    4  140/1 560/1 0/1 0/1
Exif.Photo.LensModel                         Ascii      39  EF100-400mm f/4.5-5.6L IS II USM +1.4x
Exif.CanonCs.LensType                        Short       1  Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x
Exif.CanonCs.Lens                            Short       3  140.0 - 560.0 mm
Exif.Canon.LensModel                         Ascii     138  EF100-400mm f/4.5-5.6L IS II USM +1.4x

when activating lens correction, the lens is not properly detected: 11,1025 Trouble: [Objektivkorrektur] camera/lens not found (20230722-IMG_0416.CR3 56279)

now the strange part:

if i rename the LensType via .exiv2 file:

[canon]
748=an arbitrary value

and do the same with lensfun

    <lens>
        <maker>Canon</maker>
        <model>an arbitrary value</model>

it's properly detected and the correction is applied but also ditching the blank between EF and 100-400 gives a proper result ;)

any ideas?

Steps to reproduce

get raw file to reproduce: https://mega.nz/file/2OoTyARa#653sIrHgfcKxcFVcqmbFxXDFVgk2_T1_Q30q5YoQj9c add lens data to local lensfun db - slr-canon.xml open in darktable apply lens correction

darktable version

darktable 4.7.0+59~ge8de8a0211-dirty

What OS are you using?

Mac

What is the version of your OS?

macOS14

MStraeten avatar Dec 22 '23 19:12 MStraeten

Lensfun is very picky about the naming, so it's the whitespace difference between the ExIF field it checks and the entry in its database causing problems, as you've already noticed.

ralfbrown avatar Dec 22 '23 20:12 ralfbrown

The names a identical including whitespaces- in all three cases … Verified this by setting those names via .exiv2 explicitly

MStraeten avatar Dec 23 '23 07:12 MStraeten

seems to be an issue with the fuzzy matcher, that occasionally doesn’t find exact matches (see https://github.com/lensfun/lensfun/issues/2052) there’s a pr for RT adding a further step to find exact matches if the fuzzy match doesn’t give results: https://github.com/Beep6581/RawTherapee/pull/6837

that behaviour seems to occur also with camera detection and was reported here https://github.com/darktable-org/darktable/issues/8087

MStraeten avatar Jan 03 '24 05:01 MStraeten

This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.

github-actions[bot] avatar Mar 04 '24 00:03 github-actions[bot]