Bug 311295 - Digikam not detecting my OLYMPUS M.14-42mm F3.5-5.6 II R lens
Summary: Digikam not detecting my OLYMPUS M.14-42mm F3.5-5.6 II R lens
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Editor-LensCorrection (show other bugs)
Version: 2.9.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-07 10:38 UTC by urcindalo
Modified: 2016-07-01 09:22 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.2.0


Attachments
sample picture (497.10 KB, image/jpeg)
2012-12-07 11:02 UTC, urcindalo
Details
installed lensfun file describing my lens (8.01 KB, text/plain)
2012-12-07 12:19 UTC, urcindalo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description urcindalo 2012-12-07 10:38:49 UTC
I have lensfun-0.2.6 installed, which provides data for some of the new micro-4/3 lenses including mine, a Zuiko M.14-42mm F3.5-5.6 II R lens (attached to an Oly E-PM1).

This lens is correctly detected by Darktable and Rawstudio, from which I can apply a lens correction. Also, Gwenview displays "OLYMPUS M.14-42mm F3.5-5.6 II R" in the "Lens Model" exif tag.

However, digikam-2.9.0 and previous versions is incapable of detecting my camera model and lens. What's more, when I try to manually select the lens after choosing the camera maker and model, I'm only presented with these choices:
a)  Fisheye 8-20mm f/1.0
b) Panoramic 10-100mm f/1.0
c) Rectilinear 10-1000mm f/1.0
d) Standard

No traces of micro-4/3 lenses!!

More info, just in case. I have my language set to es_ES, but Gwenview displays the lens info in an untranslated tag, "Lens Model".

Also, the camera maker is detected by Digikam as "OLYMPUS IMAGING CORP.", but I need to change it to "OLYMPUS CORPORATION" in order to find my camera model, E-PM1. This also happens in Rawstudio. It says when launched from a terminal:
WARNING **: Could not find unique camera: Make:'OLYMPUS IMAGING CORP.'. Model:'E-PM1'
But, as you can see, it correctly detects the model and also the lens, even giving me the option to fine-tune the lens model by choosing among 4 different but very similar Zuiko micro-4/3 lenses included in the lensfun-0.2.6 database.

Hope this info helps to track down the problem.

Reproducible: Always
Comment 1 urcindalo 2012-12-07 10:46:59 UTC
I forgot. This is the corresponding exif data from my pictures, as reported by exiftool:

=====================================================
Image Description               : OLYMPUS DIGITAL CAMERA
Make                            : OLYMPUS IMAGING CORP.
Camera Model Name               : E-PM1
...
---- Olympus ----
Special Mode                    : Normal, Sequence: 0, Panorama: (none)
Camera ID                       : OLYMPUS DIGITAL CAMERA
Equipment Version               : 0100
Camera Type 2                   : E-PM1
Serial Number                   : BB9501686
Internal Serial Number          : 4134108006711001
Focal Plane Diagonal            : 21.6 mm
Body Firmware Version           : 1.301
Lens Type                       : Olympus M.Zuiko Digital ED 14-42mm F3.5-5.6 II R
Lens Serial Number              : ABG235236
Lens Model                      : OLYMPUS M.14-42mm F3.5-5.6 II R
Lens Firmware Version           : 1.102
=====================================================
Comment 2 urcindalo 2012-12-07 11:02:23 UTC
Created attachment 75676 [details]
sample picture

Sample picture
Comment 3 caulier.gilles 2012-12-07 11:14:20 UTC
digiKAm use LensFun library in background to handle lens properties. This report must be moved to Lensfun project... We don't touch lensfun code, we use it only.

Look here : http://lensfun.berlios.de/

Gilles Caulier
Comment 4 urcindalo 2012-12-07 12:19:56 UTC
Created attachment 75679 [details]
installed lensfun file describing my lens

(In reply to comment #3)
> digiKAm use LensFun library in background to handle lens properties. This
> report must be moved to Lensfun project... We don't touch lensfun code, we
> use it only.

First of all, let me express how grateful I am for such a stunning software digikam is.

Secondly, I don't want to argue, just to learn. Should I infer from your words both Darktable and Rawstudio touch the lensfun code? That's the only explanation I can think of for the fact those programs can detect my lens using lensfun but digikam can not. I find it strange.

I'm no programmer, but if digikam reads the exif tags and there is one of them labelled "Lens Model" which says "OLYMPUS M.14-42mm F3.5-5.6 II R", and this same entry is found in the /usr/share/lensfun/mil-olympus.xml attached file from my lensfun-0.2.6 installation, why is it that digikam can't find the lens description just by using the lensfun installation?

I would like you to clarify the issue before going to the lensfun site to file a bug against it, because I'm not completely convinced right now this is the case.
Comment 5 Marcel Wiesweg 2012-12-09 16:27:32 UTC
Gilles, there seems to be something wrong with the way that we handle lensfun for this case.
Please note that the lens information comes from a Makernote field which we do not read currently, so loading from metadata fails in this case.
As the bug reporter points out, various lenses can be found in the mentioned database xml, these lenses are not filled into the lens combo. Why? Shouldn't all lenses with the matching mount (micro 4/3) be listed?
Comment 6 caulier.gilles 2012-12-09 16:54:17 UTC
Marcel,

> Please note that the lens information comes from a Makernote field which we do not read >currently, so loading from metadata fails in this case.

There is a small wrapper in digiKam. Look into libs/dimg/filters/lens/lensfiface::findFromMetadata(). It miss probably a rule to check this Olympus Makernotes.

>As the bug reporter points out, various lenses can be found in the mentioned database xml, 
>these lenses are not filled into the lens combo. Why? Shouldn't all lenses with the matching 
>mount (micro 4/3) be listed?

I suspect that user use internal digiKam lensfun, and user look in external source code (current one) which can be different than internal. In fact internal code is the last lensfun stable. It can be updated of course... but i think that we can always use now an external depency. In the past, i add lensfun code to digiKam because it have not very available everywhere. This is completly different now...

Gilles Caulier
Comment 7 urcindalo 2012-12-09 23:10:42 UTC
(In reply to comment #6)

> I suspect that user use internal digiKam lensfun, and user look in external
> source code (current one) which can be different than internal. In fact
> internal code is the last lensfun stable. It can be updated of course... but
> i think that we can always use now an external depency. In the past, i add
> lensfun code to digiKam because it have not very available everywhere. This
> is completly different now...

I am a Gentoo user. My digikam-2.9.0 is compiled with an "external" lensfun, or at least is seems so. You can find this in Gentoo's digikam-2.9.0.ebuild (remember it's a source "distro", we compile everything):
============
CDEPEND="
        $(add_kdebase_dep kdelibs 'semantic-desktop=')
        ....
        media-libs/lensfun
        ...
"
============

On the other hand, I don't know which lensfun version you use for its "internal" support in digikam (I believe for the precompiled binaries you perhaps provide), but micro-4/3 support in lensfun is only available starting from version 0.2.6.

Hope this info helps.
Comment 8 Marcel Wiesweg 2012-12-10 21:22:18 UTC
I checked my system lensfun and then had the same idea as you. But it's identical on my system, both 0.2.6 and both databases have the Olympus lenses which are not shown.
Comment 9 caulier.gilles 2012-12-10 21:33:24 UTC
Marcel,

Does it not show lens : 

1/ in digiKam command line test tool "testlensfuniface" ?
2/ in Image Editor ?
3/ in both ?

=> 1/ & 2/ i suspect a bug in digiKam lensfuniface
=> 3/ i suspect a bug in lensfun.

Gilles
Gilles
Comment 10 urcindalo 2012-12-12 10:19:27 UTC
(In reply to comment #9)
> 1/ in digiKam command line test tool "testlensfuniface" ?

How can I test that?
In the Image Editor no lens detection [the reason for this bug :)]

On the other hand, in my box I have two mil-olympus.xml files, but both are the same and identical to the file I previously attached:
======
$ locate mil-olympus.xml
/usr/share/apps/digikam/lensfun/mil-olympus.xml
/usr/share/lensfun/mil-olympus.xml
$ ls -la /usr/share/apps/digikam/lensfun/mil-olympus.xml
-rw-r--r-- 1 root root 8200 sep  2 12:37 /usr/share/apps/digikam/lensfun/mil-olympus.xml
$ ls -la /usr/share/lensfun/mil-olympus.xml
-rw-r--r-- 1 root root 8200 abr 20  2012 /usr/share/lensfun/mil-olympus.xml
======

It seems digikam in Gentoo does not use the system's lensfun but its own. I think I should file a bug to Gentoo bugzilla, but that's another story.
Comment 11 caulier.gilles 2012-12-12 12:31:19 UTC
urcindalo,

My comment #9 is for Marcel. digiKam testlensfuniface is a simple command line tool compiled with digiKam source when TEST code is enabled. So it's a specific case... where code need to ce compiled by yourself in your computer...

Gilles Caulier
Comment 12 urcindalo 2012-12-12 18:10:23 UTC
(In reply to comment #11)
> My comment #9 is for Marcel.

Yeah, I noticed that :) I was only trying to be helpful and thought of running the test myself.
Anyway, thanks for taking the time to clarify the issue. I really appreciate it.
Comment 13 Marcel Wiesweg 2012-12-13 21:01:25 UTC
tests/testlensfuniface.shell ~/Sample\ Images/Digikam\ Sample/JPEG/digikam-bug-311295.jpg 
unnamed app(13461)/digikam (core) _lf_get_database_dir: Lensfun database dir:  "/usr/share/kde4/apps/digikam/lensfun"
unnamed app(13461)/digikam (core) Digikam::LensFunIface::findCamera: Search for camera  "OLYMPUS IMAGING CORP." - "E-PM1"  ==> false
unnamed app(13461)/digikam (core) Digikam::LensFunIface::findFromMetadata: Cannot find Lensfun camera device for ( "OLYMPUS IMAGING CORP."  -  "E-PM1" )
unnamed app(13461)/digikam (core) Digikam::LensFunIface::findFromMetadata: Focal Length   :  22
unnamed app(13461)/digikam (core) Digikam::LensFunIface::findFromMetadata: Aperture       :  10
unnamed app(13461)/digikam (core) Digikam::LensFunIface::findFromMetadata: Subject dist.  : NOT FOUND
unnamed app(13461)/digikam (core) Digikam::LensFunIface::findFromMetadata: Metadata match :  "Partial Match"

In digikam's sidebar, the lense is listed as "unavailable".
Comment 14 caulier.gilles 2013-01-08 09:23:23 UTC
Git commit 6b07fcfc298729a5a05ffd9a4ef6f428e43b30e3 by Gilles Caulier.
Committed on 08/01/2013 at 10:21.
Pushed by cgilles into branch 'master'.

Remove internal LensFun library code and xml lens database. Set only an optional and external dependency to last 0.2.6 release.
This will spimply internal code and maintainance.
Related: bug 256466

M  +36   -58   CMakeLists.txt
M  +1    -0    NEWS
M  +47   -39   cmake/modules/FindLensFun.cmake
M  +0    -1    data/CMakeLists.txt
D  +0    -90   data/lensfun/6x6.xml
D  +0    -3    data/lensfun/CMakeLists.txt
D  +0    -5    data/lensfun/README
D  +0    -1261 data/lensfun/compact-canon.xml
D  +0    -204  data/lensfun/compact-casio.xml
D  +0    -614  data/lensfun/compact-fujifilm.xml
D  +0    -31   data/lensfun/compact-kodak.xml
D  +0    -347  data/lensfun/compact-konica-minolta.xml
D  +0    -81   data/lensfun/compact-leica.xml
D  +0    -586  data/lensfun/compact-nikon.xml
D  +0    -465  data/lensfun/compact-olympus.xml
D  +0    -423  data/lensfun/compact-panasonic.xml
D  +0    -178  data/lensfun/compact-pentax.xml
D  +0    -110  data/lensfun/compact-ricoh.xml
D  +0    -48   data/lensfun/compact-sigma.xml
D  +0    -702  data/lensfun/compact-sony.xml
D  +0    -106  data/lensfun/generic.xml
D  +0    -187  data/lensfun/mil-olympus.xml
D  +0    -122  data/lensfun/mil-panasonic.xml
D  +0    -83   data/lensfun/mil-samsung.xml
D  +0    -55   data/lensfun/mil-sony.xml
D  +0    -154  data/lensfun/rf-leica.xml
D  +0    -1282 data/lensfun/slr-canon.xml
D  +0    -36   data/lensfun/slr-contax.xml
D  +0    -31   data/lensfun/slr-hasselblad.xml
D  +0    -106  data/lensfun/slr-konica-minolta.xml
D  +0    -1110 data/lensfun/slr-nikon.xml
D  +0    -326  data/lensfun/slr-olympus.xml
D  +0    -17   data/lensfun/slr-panasonic.xml
D  +0    -419  data/lensfun/slr-pentax.xml
D  +0    -30   data/lensfun/slr-samsung.xml
D  +0    -45   data/lensfun/slr-schneider.xml
D  +0    -497  data/lensfun/slr-sigma.xml
D  +0    -317  data/lensfun/slr-sony.xml
D  +0    -285  data/lensfun/slr-tamron.xml
D  +0    -108  data/lensfun/slr-tokina.xml
D  +0    -136  data/lensfun/slr-ussr.xml
M  +1    -1    digikam/utils/config-digikam.h.cmake
M  +3    -3    imageplugins/enhance/CMakeLists.txt
M  +2    -2    imageplugins/enhance/imageplugin_enhance.cpp
D  +0    -25   libs/3rdparty/lensfun/README
D  +0    -620  libs/3rdparty/lensfun/auxfun.cpp
D  +0    -100  libs/3rdparty/lensfun/camera.cpp
D  +0    -44   libs/3rdparty/lensfun/config-lensfun.cpp
D  +0    -32   libs/3rdparty/lensfun/config-lensfun.h
D  +0    -168  libs/3rdparty/lensfun/cpuid.cpp
D  +0    -1293 libs/3rdparty/lensfun/database.cpp
D  +0    -1646 libs/3rdparty/lensfun/lens.cpp
D  +0    -2165 libs/3rdparty/lensfun/lensfun.h
D  +0    -539  libs/3rdparty/lensfun/lensfunprv.h
D  +0    -369  libs/3rdparty/lensfun/mod-color.cpp
D  +0    -1167 libs/3rdparty/lensfun/mod-coord.cpp
D  +0    -350  libs/3rdparty/lensfun/mod-subpix.cpp
D  +0    -163  libs/3rdparty/lensfun/modifier.cpp
D  +0    -73   libs/3rdparty/lensfun/mount.cpp
M  +5    -7    libs/dialogs/libsinfodlg.cpp
M  +1    -1    libs/dimg/filters/dimgfiltermanager.cpp
M  +7    -7    libs/dimg/filters/lens/lensfuniface.cpp
M  +6    -6    libs/dimg/filters/lens/lensfuniface.h
M  +2    -2    tests/CMakeLists.txt
M  +2    -2    utilities/queuemanager/CMakeLists.txt
M  +2    -2    utilities/queuemanager/manager/batchtoolsmanager.cpp

http://commits.kde.org/digikam/6b07fcfc298729a5a05ffd9a4ef6f428e43b30e3
Comment 15 caulier.gilles 2013-01-08 09:35:20 UTC
urcindalo,

To be clean with Lensfun project, digiKam 3.0.0 will drop internal lensfun code and will use an external dependency (optional). Minimal lensfun version to use will be 0.2.6.

It will be nice to report if problem still exist with current implementation (published with 3.0.0 release)

Best

Gilles Caulier
Comment 16 Teemu Rytilahti 2013-02-13 13:53:30 UTC
I have the same lens (according to the writings on the lens, exif/makernote says different) and the dropdown menu is now filled correctly, but the lens itself is not detected. Running Digikam 3.0.0 and lensfun from svn (doc path indicates the version 0.2.7.0).

From exiftool:
$ exiftool P2070135.JPG|grep -i lens
Lens Type                       : Olympus M.Zuiko Digital 14-42mm F3.5-5.6 II
Lens Serial Number              : ABGA07554
Lens Model                      : OLYMPUS M.14-42mm F3.5-5.6 II
Lens Firmware Version           : 1.103
Lens Properties                 : 0xc140
Conversion Lens                 : 
Lens ID                         : Olympus M.Zuiko Digital 14-42mm F3.5-5.6 II

And information from MakerNote tab inside photo editor:
Lens Firmware Version : 4355
Lens Model : OLYMPUS M.14-42mm F3.5-5.6 II
Lens Properties : 49472
Lens Serial Number : ABGA07554
Lens Type : 0 0 9 16 0 0

In the dropdown there is OLYMPUS M.14-42mm F3.5-5.6 II available, but it is not selected automatically. Also the label for detected information is just empty, while for Make and Model they are correctly selected.
Comment 17 Teemu Rytilahti 2013-02-19 01:26:15 UTC
Okay, I did some research today

Also, anyone knows why LensType is used instead of LensModel for detecting the lens? It looks like recent change has added LensType parsing (which was also mentioned in the sources, http://dev.exiv2.org/issues/879 is the change).

The problem is though that Lensfun expects a "cutted" version for which there's a special case for Nikon lenses in LensFunIface. LensModel seems to be the correct for Olympus though. I have submitted a patch to reviewboard to add LensModel for checked tags, url: https://git.reviewboard.kde.org/r/109017/

Output from exiv2 -pt:
Exif.OlympusEq.LensType                      Byte        6  Olympus M.Zuiko Digital 14-42mm F3.5-5.6 II
Exif.OlympusEq.LensSerialNumber              Ascii      32  ABGA07554
Exif.OlympusEq.LensModel                     Ascii      32  OLYMPUS M.14-42mm F3.5-5.6 II

Unfortunately for me the detection algorithm will give two results, both for "normal" and "R" version of the lens and doesn't thus autoselect anything.
Comment 18 Teemu Rytilahti 2013-03-21 16:03:15 UTC
Git commit 1a29366d743eccd0e8126e0c87d9aa1d00864be7 by Teemu Rytilahti.
Committed on 18/02/2013 at 22:46.
Pushed by rytilahti into branch 'master'.

Search Olympus' LensModel from Lensfun database, probably fixes #311295.

M  +3    -6    libs/dmetadata/dmetadata.cpp

http://commits.kde.org/digikam/1a29366d743eccd0e8126e0c87d9aa1d00864be7