HOME


Estimation of rotation angle of scanned (text) pages

Description:

pgmangle reads a PGM (P5) bitmap from standard input, estimates the rotation angle of the bitmap according to the pattern found in the bitmap and writes the value in degrees of the needed correction, which may be fed as a parameter to pnmrotate.

The primary use of this tool is to estimate rotation angle of scanned text pages and correction of this rotation using pnmrotate.

Usage examples:

correct rotation of a grayscale bitmap
pnmrotate `pgmangle <scanned_text.pnm ` < scanned_text.pnm > corrected_scan.pnm
correct rotation of a colour bitmap
pnmrotate `ppmtopgm <scanned_text.pnm | pgmangle` < scanned_text.pnm > corrected_scan.pnm

Automatisation script: rotate.sh

Download and compilation:

You can compile this tool from source with
cc -O3 -DNDEBUG -Wall pgmangle.c -lfftw3 -lm -o pgmangle
(you need to have libfftw version 3.0 or newer installed)


Last modified: 19.03.2013

Valid XHTML 1.1!