Bug 267436 - WISH: automatic lens correction : add auto-crop feature to remove black borders
Summary: WISH: automatic lens correction : add auto-crop feature to remove black bor...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Editor-LensCorrection (show other bugs)
Version: 1.8.0
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-02 06:56 UTC by Axel Krebs
Modified: 2017-08-06 12:13 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.2.0
Sentry Crash Report:


Attachments
resulting pic does not fit into rectangular frame (290.26 KB, image/jpeg)
2011-03-02 06:56 UTC, Axel Krebs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Axel Krebs 2011-03-02 06:56:53 UTC
Created attachment 57596 [details]
resulting pic does not fit into rectangular frame

Version:           1.8.0 (using KDE 4.5.1) 
OS:                Linux

After applying automatic lens correction function, the resulting pic shows distortion (barrel distorsion, e.g.); this is physics, and, so far, o.k.

For further using this pics, one has to cut into a rectangular shape manually(!!). 

This should happen automatically, of course!!

Reproducible: Always

Steps to Reproduce:
regular application of automatic lens correction
Comment 1 caulier.gilles 2011-03-02 07:53:15 UTC
LensFun library relevant, which do not crop result image automatically.

Gilles Caulier
Comment 2 Axel Krebs 2011-03-02 19:24:41 UTC
(In reply to comment #1)
> LensFun library relevant, which do not crop result image automatically.
> 
> Gilles Caulier

I think, this sounds too easy: when considering the KIPI-Plugins, DNG-/RAW-converter (..), DK does an absolutely great job in _intergrating_ such modules! 

Why shouldn't be a (simple?) way to crop _within_ DK, as long as such modules doesn't do this job themselves?

Cropping manually is not a good idea, because it is hazardeous "tasting for non-professionality". 

Automatical cropping could be an option for batch converting or so- without doubt another step forwards!

Hope you see it my way-


Axel
Comment 3 Johannes Wienke 2011-03-02 19:30:48 UTC
Automatic cropping code should already exist for the free rotation tool. Maybe we can use it in both places.
Comment 4 Julien Narboux 2011-03-03 09:35:58 UTC
I think it is hard to crop automatically without knowing the rotation angle.

Julien
Comment 5 caulier.gilles 2011-03-03 09:50:12 UTC
There is no auto-crop code in FreeRotation.

The crop feature is based on rotation angle. It's pure geometric computation.

An auto-crop function as under gimp must analyses image borders an choose the right band to cut in each side.

To resume : code from gimp (or from another image manaipulation code) must be backported... 

Gilles Caulier
Comment 6 Johannes Wienke 2011-03-03 11:44:38 UTC
If we could convince LensFun to produce transparent pixels for the regions that are not filled with image, then it would be easy to autocrop based on the alpha channel.
Comment 7 Axel Krebs 2011-03-03 22:33:35 UTC
(In reply to comment #6)
> If we could convince LensFun to produce transparent pixels for the regions that
> are not filled with image, then it would be easy to autocrop based on the alpha
> channel.

From my standpoint (of a very interested user), I am just wondering that nobody considered these appearently side-effects. OK, it's neither bug nor crash. For my feeling, it's like driving a Jaguar E-Type without front-screen... Nobody would buy that car, or?

Hope this works out-


Axel
Comment 8 caulier.gilles 2013-01-07 11:56:14 UTC
With current implementation from git/master, as patches from Roman I Khimov have been applied, the problem still exist ?

Gilles Caulier
Comment 9 caulier.gilles 2013-01-07 12:05:55 UTC
*** Bug 250484 has been marked as a duplicate of this bug. ***
Comment 10 caulier.gilles 2013-01-07 12:06:33 UTC
Forget comment #8, it's a wrong post...
Comment 11 caulier.gilles 2013-03-25 22:20:48 UTC
Git commit 3f60ae51ade24dd58cdc83c5f0ad4f9f99244a54 by Gilles Caulier.
Committed on 25/03/2013 at 23:17.
Pushed by cgilles into branch 'master'.

new algorithm from Sayantan Datta to auto crop image by black hole border detection.
typical use case : crop automatically assembled panorama to the most largest suitable image size
CCMAIL: kenzo.zombie@gmail.com
Related: bug 204135

M  +1    -0    CMakeLists.txt
A  +590  -0    libs/dimg/filters/transform/autocrop.cpp     [License: GPL (v2+)]
A  +75   -0    libs/dimg/filters/transform/autocrop.h     [License: GPL (v2+)]
M  +14   -1    tests/CMakeLists.txt
A  +84   -0    tests/testautocrop.cpp     [License: GPL (v2+)]

http://commits.kde.org/digikam/3f60ae51ade24dd58cdc83c5f0ad4f9f99244a54
Comment 12 caulier.gilles 2013-04-03 09:26:30 UTC
Git commit aef19efb1a69ee97c847423b4bbf1c7111bca8b7 by Gilles Caulier.
Committed on 03/04/2013 at 11:03.
Pushed by cgilles into branch 'master'.

add new BQM tool to auto-crop images

M  +1    -1    CMakeLists.txt
M  +4    -3    NEWS
M  +49   -9    utilities/queuemanager/basetools/transform/crop.cpp
M  +5    -0    utilities/queuemanager/basetools/transform/crop.h

http://commits.kde.org/digikam/aef19efb1a69ee97c847423b4bbf1c7111bca8b7
Comment 13 caulier.gilles 2013-04-03 09:27:51 UTC
To perform autocrop with LensFun tool, set a workflow in BQM including lens correction tool and crop tool with auto-crop option enabled...

Gilles Caulier