Bug 303848

Summary: BQM LensCorrection tool : doesn't work when 'use metadata' option is turned on
Product: [Applications] digikam Reporter: Maciej Słojewski <maciej.slojewski>
Component: Plugin-Bqm-LensCorrectionAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: akshay_ratan, caulier.gilles, kiril, metzpinguin, online, rik, tpr
Priority: NOR    
Version: 5.0.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 5.1.0
Attachments: For batch test puropose
Uploaded file for testing purposes.

Description Maciej Słojewski 2012-07-20 13:46:29 UTC
.jpg files made with use of digital camera ( Canon PowerShot S3 IS). When such a file is opened within digikam editor and I select a tool 'automatic lens correction', by default the following options are visible:
- show grid (unset)
- use metadata (set) and in the parentheses (found partial matching)
- Producer: Canon
- Model: Canon PowerShot S3 IS
- (...)
Then when I apply proposed changes (by clicking OK button) photo is correctly processed.

When I add the same photo to Batch Quenue Manager to default qunue (#1) and specify 'assigned tool': automatic lens correction tool and in the window 'tool setting' I specify 'use metadata' then I get the following errors:

(...) Element "*.JPG" from quenue "#1": Processing of the specified item was not successful...
(...) Element "*.JPG" from quenue "#1": All required information about lens couldn't be determined...

In other words: when I manually process photos, one by one, with use of 'automatic lens correction' tool, everything is ok. When I try to do the same action with use of 'batch quenue manager', it fails to do this action. 

My apologies, but above error messages are translated by myself from my mother tongue (Polish) into English.

Reproducible: Always

Steps to Reproduce:
1. Take any .JPG photo made with use of Canon PowerShot S3 IS
2. Put it in 'batch quenue manager'.
3. Select 'automatic lens correction' tool with 'use metadata' option set.
4. Run quenue.
Actual Results:  
I get the following errors:

(...) Element "*.JPG" from quenue "#1": Processing of the specified item was not successful...
(...) Element "*.JPG" from quenue "#1": All required information about lens couldn't be determined...


Expected Results:  
Automatic correction of the photo as it is done when the same photo is processed with use of digikam editor and I select a tool 'automatic lens correction' with 'use metadata' option set.
Comment 1 caulier.gilles 2013-01-07 11:35:17 UTC
Roman,

Your last patches over digiKam LensFunIface applied to current git/master (next 3.0.0 release) will fix this entry ?

Gilles Caulier
Comment 2 Roman I Khimov 2013-01-07 12:55:41 UTC
Gilles,

Don't tnink so, this one looks different to me.
Comment 3 caulier.gilles 2013-01-08 11:27:31 UTC
Maciej,

Can you provide some sample images to test here. Please host files on the web for download

Thanks in advance

Gilles Caulier
Comment 4 Maciej Słojewski 2013-01-08 18:58:34 UTC
Created attachment 76315 [details]
For batch test puropose

Uploaded file for testing purposes. The 1 out of 2 photos. This photo was resized down. The bug might be reproduced with this photo.
Comment 5 Maciej Słojewski 2013-01-08 18:59:33 UTC
Created attachment 76316 [details]
Uploaded file for testing purposes.

Uploaded file for testing purposes. The 2 out of 2 photos. This photo was resized down. The bug might be reproduced with this photo.
Comment 6 Maciej Słojewski 2013-01-08 19:21:12 UTC
I've prepared short screencast illustrating what is the issue. This screencast might be watched here: http://youtu.be/pCBp3qh9ESE The screencast was prepared with the same photo set as previously uploaded.
Comment 7 Akshay Ratan 2013-02-18 12:42:35 UTC
@Gilles: In reproducing this bug, what is happening on my Kubuntu 11.10 oneiric is that Lens Auto correction tool is not working at all ! Vignette correction and lens distortion is working ..any suggestions as to what can be done ? I am using digikam 3.x version on KDE 4.x....
Comment 8 caulier.gilles 2013-02-18 12:48:00 UTC
Lens AutoCorrection is not available if at least lensfun shared lib version >= 0.2.6 is not present on your system. It's a n optional dependency.

Install this lib, reconfigure with cmake, compile and install. Check at cmake config time than lensfun support is actived in cmake resume.

Note : i don't yet tested compilation and runtime using last lensfun 0.2.7

Gilles Caulier
Comment 9 Akshay Ratan 2013-03-09 11:18:45 UTC
@Gilles ::  I am triying my best to reproduce the bug, but unfortunately lens auto-correction tool is not at all working ! Tried taking help at IRC too ! 

Anyways, this is my CMake output :: http://paste.kde.org/691178/ 

Little details:: libclapack library found................. NO  (optional - internal version used instead)
libimagemagick library found............. NO  (optional)
QtKOAuth library found................... NO  (optional)

All other libraries are found! Even sorted out lensfun dependency as you advised earlier :) Please guide me a little on this.
Comment 10 Akshay Ratan 2013-03-11 07:45:21 UTC
Hi Gilles,   I am trying my best to reproduce the bug, but unfortunately lens auto-correction tool is not at all working ! Tried taking help at IRC too ! 

Anyways, this is my CMake output :: http://paste.kde.org/691178/ 

Little details:: libclapack library found................. NO  (optional - internal version used instead)
libimagemagick library found............. NO  (optional)
QtKOAuth library found................... NO  (optional)

All other libraries are found! Even sorted out lensfun dependency as you advised earlier :) I presume libclapack internal dependency with digikam might be bugging which I saw in itself is another minor bug.Please guide me a little on this.


--- On Mon, 2/18/13, Gilles Caulier <caulier.gilles@gmail.com> wrote:

From: Gilles Caulier <caulier.gilles@gmail.com>
Subject: [digikam] [Bug 303848] BQM LensCorrection tool : doesn't work when 'use metadata' option is set
To: akshay_ratan@yahoo.com
Date: Monday, February 18, 2013, 12:48 PM

https://bugs.kde.org/show_bug.cgi?id=303848

--- Comment #8 from Gilles Caulier <caulier.gilles@gmail.com> ---
Lens AutoCorrection is not available if at least lensfun shared lib version >=
0.2.6 is not present on your system. It's a n optional dependency.

Install this lib, reconfigure with cmake, compile and install. Check at cmake
config time than lensfun support is actived in cmake resume.

Note : i don't yet tested compilation and runtime using last lensfun 0.2.7

Gilles Caulier
Comment 11 caulier.gilles 2013-03-11 08:29:36 UTC
Little details:: libclapack library found................. NO  (optional - internal version used instead)
libimagemagick library found............. NO  (optional)
QtKOAuth library found................... NO  (optional)

==> we don't care : there are optional dependencies for kipi-plugins not digiKam.

From your trace http://paste.kde.org/691178/ all is ready to be compiled. Go to build dir and run make....

Gilles Caulier
Comment 12 caulier.gilles 2013-03-11 09:35:21 UTC
If Lensfun tool doesn't work, try to indentify why.

Instead to use GUI, look my test lensfun command line progam in core/test :

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/changes/tests/testlensfuniface.cpp

To compile it, turn on cmake option -DKDE4_BUILD_TESTS=on :

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/CMakeLists.txt#L1705

If you want to see debug statements on the console, run kdebugdialog and turn on digiKam, Keviv2, and others relevant debug spaces.

Gilles Caulier
Comment 13 Teemu Rytilahti 2013-04-01 13:57:35 UTC
Could this be just that when there's just a partial match, it won't proceed on BQM?

What I had in mind (as I have similar problem, for some reason lensfun returns two lenses instead of the "strict" match) to save the selected lens after asking user about it. So when lensfun returns multiple matches (in my case "<lens>" and "<lens> r", allow user to save the preferred lens and use that as a default from that point.
Comment 14 caulier.gilles 2013-11-28 16:12:30 UTC
Git commit 09e5724cc30efa46314fb773be318890be1d32c4 by Gilles Caulier.
Committed on 28/11/2013 at 16:10.
Pushed by cgilles into branch 'master'.

apply patch from Teemu Rytilahti to handle properly multiple matches of lens from lensfun
REVIEW: 111021

M  +32   -26   libs/dimg/filters/lens/lensfuniface.cpp

http://commits.kde.org/digikam/09e5724cc30efa46314fb773be318890be1d32c4
Comment 15 Matthias Weiss 2014-06-07 18:00:44 UTC
Hi Gilles,

    I've experiencing the same problem with my Sony Nex 5r + Sony SEL 35mm f/1.8 lens, in the BQM the automatic lens correction fails because it can't find the lens in lensfun. I also tried it with the editor, here also the lens isn't detected automatically. When I then select the the lens manually the correction ist applied correctly.

I'm using raw files in the BQM.

Tell me if I can help with debugging ...

(and thanx for this awesome piece of software! :-) )
Comment 16 Matthias Weiss 2014-06-07 18:02:40 UTC
I forgot: I'm using digikam 4.0.0 with lensfun 0.2.8 on debian unstable.
Comment 17 caulier.gilles 2016-07-04 08:42:03 UTC
This file still valid using digiKam 5.0.0 ?

Gilles Caulier
Comment 18 Kiril Vladimirov 2016-07-06 08:15:08 UTC
I have the same issue with digiKam 5.0.0. The lens auto-correction can't determine the subject distance (camera and lens are detected correctly) and instead of assuming default value like the image editor (i.e. 0.0) it fails completely.

Is there a way to work-around this?
Comment 19 Maik Qualmann 2016-07-06 17:22:55 UTC
Git commit 81dfd7dced674efdbe768413330513d29d7b94dd by Maik Qualmann.
Committed on 06/07/2016 at 17:22.
Pushed by mqualmann into branch 'master'.

use default value for object distance when not available

M  +10   -12   libs/dimg/filters/lens/lensfuniface.cpp

http://commits.kde.org/digikam/81dfd7dced674efdbe768413330513d29d7b94dd
Comment 20 Maik Qualmann 2016-07-06 17:41:01 UTC
Not all cameras reports the subject distance. Here recommends Lensfun a value of 1000. We use now this value when missing the subject distance in the metadata. The camera from Description is not supported by Lensfun. Please report this to the Lensfun team. I close this bug now. If necessary, please reopen.

Maik