galfar / deskew

Deskew is a command line tool for deskewing scanned text documents. It uses Hough transform to detect "text lines" in the image. As an output, you get an image rotated so that the lines are horizontal.
http://galfar.vevb.net/deskew
Mozilla Public License 2.0
163 stars 26 forks source link

Auto determine angle range for skew detection #18

Open galfar opened 5 years ago

galfar commented 5 years ago

Right now skew detection is by default done in [-10°, 10°] angle range. This limitation is there to keep the time taken by the detection reasonable for the most likely inputs (scanned pages slightly misaligned). User can change this range with -a parameter.

Also to keep the time down the range is searched in sampling steps of 0.1° so skews lower than this cannot be detected.

Proposal: do a two pass detection. First in a much bigger range that current default (+/-45°?) with bigger sampling step (2-5°?). Then do a finer second pass in a vicinity of skew angle detected by the first rough pass.

No idea how well this could work :slight_smile: