Bug 266204 - Inconsistent results with distortion correction between digikam, lensfun tool (tmod) and ufraw
Summary: Inconsistent results with distortion correction between digikam, lensfun tool...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Editor-LensCorrection (show other bugs)
Version: 1.8.0
Platform: Compiled Sources Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on: 312764
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-13 15:23 UTC by Xavier Raynaud
Modified: 2016-07-01 09:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 3.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xavier Raynaud 2011-02-13 15:23:19 UTC
Version:           1.8.0 (using KDE 4.5.5) 
OS:                Linux

I'm having troubles using the distortion correction tool of digikam with my Panasonic GF1 and the 20mm pancake lensfun. 
There exists 2 lensfun parameter set to correct gf1/20mm images. One is distributed in lensfun CVS and works pretty well with lensfun tmod tool. I made the other which works relatively well with ufraw (http://xraynaudphotos.free.fr/lensfun.php). For some strange reason, the ufraw parameter set doesn't work with tmod and vice versa. This inconsistency between  has already been filed at ufraw's bug system.
Unfortunately, none of these parameters sets appear to work with digikam which corrects too much the distortion. Follows are 3 jpegs showing the corrections 
* lensfun parameters corrected image: http://xraynaudphotos.free.fr/temp/lensfun.jpg
* ufraw parameters corrected image: http://xraynaudphotos.free.fr/temp/ufraw.jpg
* original raw file : http://xraynaudphotos.free.fr/temp/P1010941.RW2

I may do something wrong, but I don't know what. 
Thanks for your help

Xavier. 

Reproducible: Always

Steps to Reproduce:
open a panasonic gf1 (with 20mm lens) raw image, open distortion auto-correction, select panasonic gf1 and 20mm lens, look at the results. 

Actual Results:  
image corrected too heavilly

Expected Results:  
distortion corrected image
Comment 1 caulier.gilles 2011-12-17 19:04:18 UTC
Xavier,

This file still valid using digiKam 2.4 ?

Gilles Caulier
Comment 2 caulier.gilles 2013-01-07 10:23:42 UTC
Git commit 8b3eb6f0b498ae11729e0880e7ac0673b2dd2bd8 by Gilles Caulier.
Committed on 07/01/2013 at 11:16.
Pushed by cgilles into branch 'master'.

Apply patch #76254 from Roman I Khimov about lensfun interface which don't mangle cropFactor if it's set.
This behaviour was introduced by polish commit bebef401e147a00f859cb81774f8498a0623eee5.
With this branch present we always get cropFactor of
-1.0 in LensFunFilter::filterImage() and given that lensfun library just uses
crop factor of 1 which leads to obviously wrong calculations for cropped
cameras.
Related: bug 312764, bug 253941, bug 267613, bug 281783, bug 284708
FIXED-IN: 3.0.0
CCMAIL: rik@osrc.info

M  +0    -4    libs/dimg/filters/lens/lensfuncameraselector.cpp

http://commits.kde.org/digikam/8b3eb6f0b498ae11729e0880e7ac0673b2dd2bd8
Comment 3 caulier.gilles 2013-01-07 10:37:38 UTC
Git commit 613d004121682d122e9ea7fd9041a7bbc49acb89 by Gilles Caulier.
Committed on 07/01/2013 at 11:34.
Pushed by cgilles into branch 'master'.

Apply patch #76256 from Roman I Khimov to use crop factor from camera, not from lens data.
Lens crop factor in DB only tells us which crop factor was used for lens
calibration data, but it has nothing to do with shots made on random user's
camera. So the default behaviour should be to use camera's crop factor and only
fallback to lens data if there in no data present for camera. As "this should
not happen" it's appropriate to spit out some debug message in this case.

Ref: http://lensfun.berlios.de/manual/el_lens.html
Ref: http://lensfun.berlios.de/manual/el_camera.html
Related: bug 312766, bug 312764, bug 253941, bug 267613, bug 281783, bug 284708
FIXED-IN: 3.0.0
CCMAIL: roman@khimov.ru

M  +2    -1    libs/dimg/filters/lens/lensfuncameraselector.cpp
M  +1    -1    libs/dimg/filters/lens/lensfuniface.cpp

http://commits.kde.org/digikam/613d004121682d122e9ea7fd9041a7bbc49acb89
Comment 4 caulier.gilles 2013-01-07 10:41:44 UTC
Git commit 70cf9beaac9996c219f988d8ae74d75dc253c0ad by Gilles Caulier.
Committed on 07/01/2013 at 11:39.
Pushed by cgilles into branch 'master'.

Apply patch #76255 from Roman I Khimov to don't pass crop factor as scale factor to lensfun.

Sixth parameter to Initialize() is actually a scale factor which has nothing
in common with crop factor. I think it's safe to assume that we want no
scaling from lensfun and thus use the value of one.

Ref: http://lensfun.berlios.de/manual/structlfModifier.html
Related: bug 312765, bug 312764, bug 253941, bug 267613, bug 281783, bug 284708
FIXED-IN: 3.0.0
CCMAIL: roman@khimov.ru

M  +1    -1    libs/dimg/filters/lens/lensfunfilter.cpp

http://commits.kde.org/digikam/70cf9beaac9996c219f988d8ae74d75dc253c0ad