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