Version: 1.4.0 (using KDE 4.4.3)
Digikam Lens correction wasn't automatically choosing the correct lens from the lensfun database. Canon cameras return different information for the Lens and LensType tags:
$ exiv2 -pa IMG_2775.JPG |grep Lens
Exif.CanonCs.LensType Short 1 Canon EF 70-300mm f/4-5.6 IS USM
Exif.CanonCs.Lens Short 3 70.0 - 300.0 mm
While the Lens tag has valid information, the actual Lens model is only correct in LensType.
With the attached patch (only, no other patches), digikam automatically matches the correct lens.
Steps to Reproduce:
Find an image taken on a Canon DSLR (I used Canon EOS 500D) with a lens listed in the lensfun database (I used "Canon EF-S 17-85mm f/4-5.6 IS USM", which is in lensfun 0.2.5, and and "Canon EF 70-300mm f/4-5.6 IS USM" for which I have created a lens profile). Enter the editor, Enhance->Lens->Auto-correction
See that you need to select the lens manually.
The lens should be selected automatically.
With the attached patch, images taken with both lenses I have resulted in automatic selection of the correct lens profile.
Created attachment 51856 [details]
Trivial patch to use LensType tag on Canon
Created attachment 51857 [details]
Patch formatted better to retain comment alignment
digiKam 1.5.0 has already a similar patch applied.
I applied the fix in http://websvn.kde.org/branches/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp?r1=1165407&r2=1172473 to 1.4.0, and it did not work as expected. Instead of automatically matching the exact lens, it matched a different lens which had a focal length range that covered the shortest focal length. In the quick test I did, instead of matching EF-S 17-85mm f/4-5.6 IS USM, it matched EF-S 10-22mm f/3.5-4.5 USM.
If I instead place the append call with Exif.CanonCs.LensType before Exif.CanonCs.Lens, then it works as expected.
I should probably build from svn, but assuming no other major changes were made, I think this is not fixed.
I can supply a sample image if that would help test (I assume some other Canon DSLRs, such as 40D, work with the Exif.CanonCs.Lens tag, and we actually would prefer both types to work, not one or the other).
yes send me by mail a test image, or give me a web link to download it
Looks like it is fixed in trunk in r1178204
In 2.0 branch it still detects the wrong lens for "Canon EF-S 18-55mm f/3.5-5.6 IS" as "Canon EF-S 10-22mm f/3.5-4.5 USM". Although the database has only "Canon EF-S 18-55mm f/3.5-5.6" (without the IS), so that may be the problem. I'd propose to do a regular expression match (if it isn't already, not sure).
There is 2 way to fix this problem: the regex is done in liblensfun using GLib2. I suspect that code is not perfect at this place. This can be fixed in lensfun code of course and reported to lensfun project to backport patch.
This is done by this stage 1 :
Another way is to patch the digiKam lenfun interface to process a regex based on Qt4::QString. Stage 2 is specific to Nikon camera/lens:
There is the last stage :
I recommend to add a new stage for Canon camera before last stage, if you choose to patch digiKam lensfun interface source code.
Please patch trunk, i will backport later GSoC 2010 branch.
By looking at that, I think that just doing a "reverse search" could be enough. Because now it takes the exiv data and looks into the database. But if this string is just longer by the "IS" or something, it won't match. But if it would be done the other way round - by matching the database to the exiv string, this would work. Consider a use case, when the manufacturer creates just new lenses and adds stuff to the string (like "IS" or something else) but the actual lenses stays the same, this would still get matched with my proposed way.
Okay, I'll play with it a little and see what I can come up with.