1Pamthreshold User Manual(0)                        Pamthreshold User Manual(0)
2
3
4

NAME

6       pamthreshold - threshold grayscale image to black and white
7
8

SYNOPSIS

10       pamthreshold   [-simple]   [-local=widthxheight]   [-dual=widthxheight]
11       [-threshold=threshold] [-contrast=threshold] [inputpamfile]
12
13       Minimum unique abbreviations of options are  acceptable.  You  may  use
14       double  hyphens  instead  of a single hyphen to denote options. You may
15       use white space in place of the equals sign to separate an option  name
16       from its value.
17
18

DESCRIPTION

20       This program is part of Netpbm(1).
21
22       pamthreshold  thresholds a grayscale image. Thresholding means dividing
23       the image into background and foreground by comparing every pixel to  a
24       thresholding value.
25
26       The  input should be a PGM image or a PAM image of tuple type GRAYSCALE
27       or GRAYSCALE_ALPHA.   However,  pamthreshold  doesn't  check;  it  just
28       thresholds  the  first  channel  as if it were grayscale samples and if
29       there is a second channel, processes it as  if  it  is  a  transparency
30       (alpha)  channel.  So if you feed it e.g. a PPM image, it will work but
31       produce probably useless results.
32
33       The output  is  a  PAM  with  tuple  type  BLACKANDWHITE  or  BLACKAND‐
34       WHITE_ALPHA, depending on whether the input has a transparency channel.
35       You can turn this into a PBM (if you need to use it with an older  pro‐
36       gram  that doesn't understand PAM, or you can't afford the 8X amount of
37       space that PAM uses for the image) with pamtopnm.
38
39       The output is to Standard Output.
40
41       When the input has a  transparency  channel,  pamthreshold  includes  a
42       transparency channel in the output.  Since the output has maxval 1, the
43       transparency channel can  indicate  only  fully  transparent  or  fully
44       opaque.  pamthreshold make it fully transparent where the input is more
45       than half transparent and fully opaque where it isn't.
46
47       The transparency function was new in Netpbm 10.43 (June 2008).   Before
48       that, pamthreshold ignores any transparency channel in the input.
49
50       Another  way  to  convert  a  grayscale  image to black and white is to
51       dither.  Dithering is using clustered black and white pixels such  that
52       if  you  step  back  and look at the picture, you see varying levels of
53       gray.  pamditherbw does dithering.
54
55

OPTIONS

57       In addition to the options common to all programs  based  on  libnetpbm
58       (most notably -quiet, see
59        Common  Options  ⟨index.html#commonoptions⟩ ), pamthreshold recognizes
60       the following command line options:
61
62       Without any options, pamthreshold uses a method based on the  iterative
63       algorithm found in the wikipedia ⟨http://www.wikipedia.org/⟩  article
64        Thresholding                     (image                    processing)
65http://en.wikipedia.org/wiki/Thresholding_%28image_processing%29⟩   to
66       compute     the     thresholding     value.      (     this     version
67http://en.wikipedia.org/w/index.php?title=Thresholding_%28image_processing%29&oldid=132306976⟩
68        of the Wikipedia article was current at the time of this writing).  It
69       uses this threshold to globally threshold the image.  This should  work
70       well  for  most  images.  The program issues a message telling you what
71       threshold it used.  (Netpbm messages go to Standard Error, and you  can
72       turn them off with the Netpbm common option -quiet).
73
74       Options -simple, -local, and -dual select other methods.
75
76
77
78
79       -simple
80              This  selects  simple  or global thresholding, i.e. pamthreshold
81              compares every pixel to the threshold you specify with  -thresh‐
82              old.   Those  with  a  brightness  greater  than or equal to the
83              threshold become white; others become black.   This  works  well
84              for  black  and  white text pages scanned with a flatbed scanner
85              and is faster than the default method  that  iteratively  deter‐
86              mines the thresholding value first.
87
88
89       -local=widthxheight
90              This  selects local adaptive thresholding (also known as dynamic
91              thresholding) using the neighborhood which is the  square  width
92              pixels  wide  and  height  pixels  high centered on the pixel in
93              question.  pamthreshold computes the threshold individually  for
94              each pixel of the image.  This can accommodate changing lighting
95              conditions in the image.  Depending on the size of the neighbor‐
96              hood this can be quite slow.
97
98
99       -dual=widthxheight
100              This  selects  a  dual  thresholding  algorithm  using  a global
101              threshold for low contrast neighborhoods and local  thresholding
102              otherwise.   This  can  preserve larger back- respectively fore‐
103              ground areas than local adaptive thresholding.   This  algorithm
104              was proposed in the paper "An Approach To Licence Plate Recogni‐
105              tion" by J.R. Parker and Pavol Federl.
106
107
108       -threshold=threshold
109              This sets the thresholding value for simple or local  threshold‐
110              ing.   The  value is a floating point number in the range [0, 1]
111              directly proportional to the Netpbm sample values, where 0  cor‐
112              responds to black and 1 to the maxval of the image.
113
114              If  you don't specify this option, pamthreshold uses a threshold
115              of 0.5.
116
117              Without -simple, -local, or -dual, this option is meaningless.
118
119              The meaning of the threshold depends upon the kind of threshold‐
120              ing you do (as determined by other options).  Roughly, pixels at
121              least as bright as the threshold  become  white  in  the  output
122              while others become black.
123
124
125       -contrast=threshold
126              This  sets  the threshold to determine if a neighborhood has low
127              contrast or not for dual thresholding.  The value is a  floating
128              point number in the range [0, 1].
129
130              If  you  don't specify this option, pamthreshold uses a contrast
131              threshold of 0.05.  Without -dual this option is meaningless.
132
133
134
135
136

SEE ALSO

138       pamditherbw(1), ppmtopgm(1), pamtopnm(1), pam(1)
139
140

HISTORY

142       pamthreshold was new in Netpbm 10.34 (June 2006).
143
144

AUTHOR

146       pamthreshold is Copyright © 2006 by Erik Auerswald and  released  under
147       the GPL(1).
148

DOCUMENT SOURCE

150       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
151       source.  The master documentation is at
152
153              http://netpbm.sourceforge.net/doc/pamthreshold.html
154
155netpbm documentation             06 June 2007      Pamthreshold User Manual(0)
Impressum