1Pamtilt User Manual(0) Pamtilt User Manual(0)
2
3
4
6 pamtilt - print the tilt angle of a PGM file
7
8
10 pamtilt [-angle=maxangle] [-fast] [-quality=q] [-hstep=n] [-vstep=n]
11 [-dstep=n] [-astep=n] [-verbose] [pgmfile]
12
13
15 scanimage --mode Gray --resolution 300 >crooked.pgm
16 pnmrotate -b white `pamtilt crooked.pgm` crooked.pgm >straight.pgm
17 (then crop, threshold, etc.)
18
19
21 This program is part of Netpbm(1).
22
23 pamtilt tries to find the correct angle for untilting (de-skewing) a
24 scanned text document. The output is a single floating-point number
25 (the angle in degrees) for use as the argument to pnmrotate.
26
27 "Document skew" is the name given to what happens when you feed a page
28 into an image scanner at an angle: the resulting image is tilted.
29 pamtilt aims to help correct that.
30
31 pamtilt makes three iterations at successively finer increments, test‐
32 ing prospective rotation angles to find the best one. pamtilt works
33 best for straightening images with strong horizontal lines and does
34 poorly with arbitrary photos. If pamtilt has no confidence in its
35 results, it prints the special value 00.00; you can check for this or
36 just pass it as a legal argument to pnmrotate.
37
38 pamtilt operates on the first plane of the input image, which is either
39 PNM or PAM, and ignores any other planes. Ordinarily, the input is PGM
40 or GRAYSCALE PAM, so there is only one plane.
41
42 pamtilt works on bilevel (PBM, BLACKANDWHITE PAM) images as well as
43 grayscale, but you will minimize artifacts if you scan and rotate in
44 grayscale before you apply a threshold to make a bilevel image.
45
46
48 In addition to the options common to all programs based on libnetpbm
49 (most notably -quiet, see
50 Common Options ⟨index.html#commonoptions⟩ ), pamtilt recognizes the
51 following command line options:
52
53
54
55
56 -angle=maxangle
57 Assume a maximum tilt angle of maxangle (measured in degrees).
58 The default value is sufficient for most images, even those
59 scanned somewhat carelessly.
60
61 The default is 10.0.
62
63
64 -fast Skip the third iteration for speed at the expense of accuracy.
65
66
67 -verbose
68 Show on Standard Error the measurements computed at each tested
69 angle.
70
71
72
73 Here are some other options you can use to tune the operation of
74 pamtilt but they're seldom needed. The default values accommodate a
75 wide variety of input documents.
76
77
78
79
80 -quality=q
81 Require a signal-to-noise ratio of a least q on the first itera‐
82 tion to report a valid result. Larger values reduce the chances
83 of obtaining a bogus result at the risk of obtaining no result
84 at all.
85
86 The default is 1.0.
87
88
89 -hstep=n
90 Set the horizontal increment to check every nth column. This
91 value affects both run time and memory requirements.
92
93 The default is 11.
94
95
96 -vstep=n
97 Set the vertical increment to check every nth row. Larger val‐
98 ues usually work, reducing run time, but they increase the risk
99 of incorrect results.
100
101 The default is 5.
102
103
104 -dstep=n
105 Set the vertical distance used when checking pixels in a column.
106 The default is intended to minimize the effect of noise along a
107 horizontal boundary.
108
109 The default is 2.
110
111
112 -astep=n
113 Set the angle increment of the first iteration, in degrees.
114
115 The default is 1.0.
116
117
118
119
120
122 pamtilt implements a somewhat simplified algorithm inspired by: "Mea‐
123 suring Document Image Skew and Orientation", by Bloomberg, Kopec, and
124 Dasari. In SPIE Volume 2422, Document Recognition II, pages 302-316,
125 February 1995.
126
127
129 ·
130
131 pnmrotate(1)
132
133 ·
134
135 pgm(1)
136
137
138
140 pamtilt was new in Netpbm 10.30 (October 2005).
141
142 Gregg Townsend wrote it and sent it to Bryan Henderson in August 2005.
143 Bryan recoded it to fit Netpbm conventions.
144
146 This manual page was generated by the Netpbm tool 'makeman' from HTML
147 source. The master documentation is at
148
149 http://netpbm.sourceforge.net/doc/pamtilt.html
150
151netpbm documentation 28 August 2005 Pamtilt User Manual(0)