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 A few options have general utility:
49
50
51
52
53 -angle=maxangle
54 Assume a maximum tilt angle of maxangle (measured in degrees).
55 The default value is sufficient for most images, even those
56 scanned somewhat carelessly.
57
58 The default is 10.0.
59
60
61 -fast Skip the third iteration for speed at the expense of accuracy.
62
63
64 -verbose
65 Show on Standard Error the measurements computed at each tested
66 angle.
67
68
69
70 Here are some other options you can use to tune the operation of
71 pamtilt but they're seldom needed. The default values accommodate a
72 wide variety of input documents.
73
74
75
76
77 -quality=q
78 Require a signal-to-noise ratio of a least q on the first itera‐
79 tion to report a valid result. Larger values reduce the chances
80 of obtaining a bogus result at the risk of obtaining no result
81 at all.
82
83 The default is 1.0.
84
85
86 -hstep=n
87 Set the horizontal increment to check every nth column. This
88 value affects both run time and memory requirements.
89
90 The default is 11.
91
92
93 -vstep=n
94 Set the vertical increment to check every nth row. Larger val‐
95 ues usually work, reducing run time, but they increase the risk
96 of incorrect results.
97
98 The default is 5.
99
100
101 -dstep=n
102 Set the vertical distance used when checking pixels in a column.
103 The default is intended to minimize the effect of noise along a
104 horizontal boundary.
105
106 The default is 2.
107
108
109 -astep=n
110 Set the angle increment of the first iteration, in degrees.
111
112 The default is 1.0.
113
114
115
116
117
119 pamtilt implements a somewhat simplified algorithm inspired by: "Mea‐
120 suring Document Image Skew and Orientation", by Bloomberg, Kopec, and
121 Dasari. In SPIE Volume 2422, Document Recognition II, pages 302-316,
122 February 1995.
123
124
126 ·
127
128 pnmrotate(1)
129
130 ·
131
132 pgm(1)
133
134
135
137 pamtilt was new in Netpbm 10.30 (October 2005).
138
139 Gregg Townsend wrote it and sent it to Bryan Henderson in August 2005.
140 Bryan recoded it to fit Netpbm conventions.
141
143 This manual page was generated by the Netpbm tool 'makeman' from HTML
144 source. The master documentation is at
145
146 http://netpbm.sourceforge.net/doc/pamtilt.html
147
148netpbm documentation 28 August 2005 Pamtilt User Manual(0)