summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-rawhide/man1/pamtilt.1
blob: 07b8c762348ca0181ad9ee3e0ddd3a05138a0cd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
\
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
.\" Do not hand-hack it!  If you have bug fixes or improvements, please find
.\" the corresponding HTML page on the Netpbm website, generate a patch
.\" against that, and send it to the Netpbm maintainer.
.TH "Pamtilt User Manual" 0 "28 August 2005" "netpbm documentation"

.SH NAME
pamtilt - print the tilt angle of a PGM file

.UN synopsis
.SH SYNOPSIS

\fBpamtilt\fP
[\fB-angle=\fP\fImaxangle\fP]
[\fB-fast\fP]
[\fB-quality=\fP\fIq\fP]
[\fB-hstep=\fP\fIn\fP]
[\fB-vstep=\fP\fIn\fP]
[\fB-dstep=\fP\fIn\fP]
[\fB-astep=\fP\fIn\fP]
[\fB-verbose\fP]
[\fIpgmfile\fP]

.UN examples
.SH EXAMPLES

.nf
\f(CW
    scanimage --mode Gray --resolution 300 >crooked.pgm
    pnmrotate -b white `pamtilt crooked.pgm` crooked.pgm >straight.pgm
\fP
    (then crop, threshold, etc.)

.fi

.UN description
.SH DESCRIPTION
.PP
This program is part of
.BR "Netpbm" (1)\c
\&.
.PP
\fBpamtilt\fP tries to find the correct angle for untilting
(de-skewing) a scanned text document.  The output is a single
floating-point number (the angle in degrees) for use as the argument
to pnmrotate.
.PP
"Document skew" is the name given to what happens when
you feed a page into an image scanner at an angle: the resulting image
is tilted.  \fBpamtilt\fP aims to help correct that.
.PP
\fBpamtilt\fP makes three iterations at successively finer
increments, testing prospective rotation angles to find the best one.
\fBpamtilt\fP works best for straightening images with strong
horizontal lines and does poorly with arbitrary photos.  If
\fBpamtilt\fP has no confidence in its results, it prints the special
value 00.00; you can check for this or just pass it as a legal
argument to pnmrotate.
.PP
\fBpamtilt\fP operates on the first plane of the input image,
which is either PNM or PAM, and ignores any other planes.  Ordinarily,
the input is PGM or GRAYSCALE PAM, so there is only one plane.
.PP
\fBpamtilt\fP works on bilevel (PBM, BLACKANDWHITE PAM) images as
well as grayscale, but you will minimize artifacts if you scan and
rotate in grayscale before you apply a threshold to make a bilevel
image.
        
.UN options
.SH OPTIONS
.PP
In addition to the options common to all programs based on libnetpbm
(most notably \fB-quiet\fP, see 
.UR index.html#commonoptions
 Common Options
.UE
\&), \fBpamtilt\fP recognizes the following
command line options:



.TP
\fB-angle=\fP\fImaxangle\fP
Assume a maximum tilt angle of \fImaxangle\fP (measured in degrees).
The default value is sufficient for most images, even those scanned
somewhat carelessly.
.sp
The default is 10.0.

.TP
\fB-fast\fP
Skip the third iteration for speed at the expense of accuracy.

.TP
\fB-verbose\fP
Show on Standard Error the measurements computed at each tested angle.


.PP
Here are some other options you can use to tune the operation of
\fBpamtilt\fP but they're seldom needed.  The default values
accommodate a wide variety of input documents.


.TP

\fB-quality=\fP\fIq\fP
Require a signal-to-noise ratio of a least \fIq\fP on the first
iteration to report a valid result.  Larger values reduce the chances
of obtaining a bogus result at the risk of obtaining no result at all.
.sp
The default is 1.0.

.TP
\fB-hstep=\fP\fIn\fP
Set the horizontal increment to check every \fIn\fPth column.  This
value affects both run time and memory requirements.
.sp
The default is 11.

.TP
\fB-vstep=\fP\fIn\fP
Set the vertical increment to check every nth row.  Larger values
usually work, reducing run time, but they increase the risk of
incorrect results.
.sp
The default is 5.

.TP
\fB-dstep=\fP\fIn\fP
Set the vertical distance used when checking pixels in a column.  The
default is intended to minimize the effect of noise along a horizontal
boundary.
.sp
The default is 2.

.TP
\fB-astep=\fP\fIn\fP
Set the angle increment of the first iteration, in degrees.
.sp
The default is 1.0.




.UN references
.SH REFERENCES
.PP
\fBpamtilt\fP implements a somewhat simplified algorithm inspired
by: "Measuring Document Image Skew and Orientation", by Bloomberg,
Kopec, and Dasari.  In SPIE Volume 2422, Document Recognition II,
pages 302-316, February 1995.

.UN seealso
.SH SEE ALSO


.IP \(bu

.BR "\fBpnmrotate\fP" (1)\c
\&
.IP \(bu

.BR "pgm" (1)\c
\&


.UN history
.SH HISTORY
.PP
\fBpamtilt\fP was new in Netpbm 10.30 (October 2005).
.PP
Gregg Townsend wrote it and sent it to Bryan Henderson in August
2005.  Bryan recoded it to fit Netpbm conventions.
.SH DOCUMENT SOURCE
This manual page was generated by the Netpbm tool 'makeman' from HTML
source.  The master documentation is at
.IP
.B http://netpbm.sourceforge.net/doc/pamtilt.html
.PP