Bug 224612 - Auto-straightening: identify straight lines and rotate the photo according to them
Summary: Auto-straightening: identify straight lines and rotate the photo according to...
Status: CONFIRMED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Editor-Rotation (show other bugs)
Version: 1.2.0
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-28 11:57 UTC by Dotan Cohen
Modified: 2016-08-16 07:17 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dotan Cohen 2010-01-28 11:57:56 UTC
Version:            (using Devel)
Installed from:    Compiled sources

If there is a way for Digikam to identify straight lines in photos, then it would be great if the user could select a line and Digikam would straighten the image accordingly.
Comment 1 Dotan Cohen 2010-01-28 11:59:34 UTC
The now-defunct BrilliantPhoto had this feature, so technically it is possible. The user would hover over the image and the straight lines would be highlighted. Selecting one would instruct the application to straighten as per that line.
Comment 2 caulier.gilles 2010-01-28 12:05:21 UTC
Do you have tried current version of FreeRotation tool ? It have this option.

Gilles Caulier
Comment 4 Dotan Cohen 2010-01-28 13:00:31 UTC
I have Digikam 1.0.0 installed, and it looks just as your screenshots do (I love that picture, by the way). The user can set two points, which is great, but it does not automatically identify the straight edge.
Comment 5 caulier.gilles 2010-01-28 13:17:24 UTC
Do you know a code somewhere to find automatically point 1/ and 2/ in the image ?

Gilles Caulier
Comment 6 Johannes Wienke 2010-01-28 13:30:02 UTC
You could use the http://en.wikipedia.org/wiki/Hough_transform to find straight lines in an image.
Comment 7 Johannes Wienke 2010-01-28 17:46:54 UTC
http://www.inf.ufrgs.br/~laffernandes/kht.html seems to be a free implementation.
Comment 8 caulier.gilles 2010-01-29 12:44:22 UTC
Yes, KHT is published as GPL.

core algorithm is pure C++. No problem to use it.

For the rest, we nned to take a look in test application code.

Gilles Caulier
Comment 9 Johannes Wienke 2010-01-29 12:57:05 UTC
I don't think it will do all the work we need. I would expect that the code returns all detected lines and these lines need to be interpreted by us, e.g. by averaging over all lines with 10 angle difference from exactly horizontal or some other heuristic.
Comment 10 Jens Mueller 2010-01-29 18:01:51 UTC
Just for notice: CImg image library does also hough transform and is already included in digikam. 

And just my wish:
Please consider following behaviour: 
1.) get lines out of hough transform with given treshold,
2.) display them semitransparent ontop of image
3.) as the user moves the mouse over the image area, hover the next line in distance and make it apply with a simple left click
Comment 11 Arnd Baecker 2010-01-29 18:48:39 UTC
I fully agree with Jens' comment.
Some ages ago, I played around with the openCV code given here:
http://opencv.willowgarage.com/documentation/feature_detection.html
under "HoughLines2". The routine even has parameters to
specify the angular resolution of found lines (depending on the algorithm).
So this might already address Johannes' remark.
If the algorithm works well enough, code-wise most of the work 
would be on the GUI side...
Comment 12 Dotan Cohen 2010-01-31 07:16:37 UTC
I agree with Jens in Comment #10.
Comment 13 caulier.gilles 2011-12-17 19:18:54 UTC
Dotan,

This file still valid using digiKam 2.x serie ?

Gilles Caulier
Comment 14 Dotan Cohen 2011-12-18 07:03:10 UTC
Yes, Gilles. Currently the only way to straighten an image is to open it in the editor and to set two points to define the angle. The makes the operation a chore and means that I don't straighten any images! Having the main Digikam window automatically highlight potential lines for straightening would be terrific. I would suggest a toggle that enables / disables the line overlays while browsing images so that users could add image straightening to their workflows.

Thanks.