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  an  alpha  (trans‐
30       parency) 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 an alpha channel.  You
35       can turn this into a PBM (if you need to use it with an  older  program
36       that doesn't understand PAM, or you can't afford the 8X amount of space
37       that PAM uses for the image) with pamtopnm.
38
39       The output is to Standard Output.
40
41       When the input has an alpha channel,  pamthreshold  includes  an  alpha
42       channel  in the output.  Since the output has maxval 1, the alpha chan‐
43       nel can indicate only fully transparent or fully opaque.   pamthreshold
44       make it fully transparent where the input is more than half transparent
45       and fully opaque where it isn't.
46
47       The alpha function was new in Netpbm 10.43 (June 2008).   Before  that,
48       pamthreshold ignores any alpha 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       Without any options, pamthreshold uses an iterative algorithm found  in
58       the wikipedia ⟨http://www.wikipedia.org/⟩  article
59        Thresholding                     (image                    processing)
60http://en.wikipedia.org/wiki/Thresholding_%28image_processing%29⟩   to
61       compute     the     thresholding     value.      (     this     version
62http://en.wikipedia.org/w/index.php?title=Thresholding_%28image_processing%29&oldid=132306976⟩
63        of the Wikipedia article was current at the time of this writing).  It
64       uses this threshold to globally threshold the image.  This should  work
65       well  for  most  images.  The program issues a message telling you what
66       threshold it used.  (Netpbm messages go to Standard Error, and you  can
67       turn them off with the Netpbm common option -quiet).
68
69
70
71
72       -simple
73              This  selects  simple  or global thresholding, i.e. pamthreshold
74              compares every pixel to the threshold you specify with  -thresh‐
75              old.   Those  with  a  brightness  greater  than or equal to the
76              threshold become white; others become black.   This  works  well
77              for  black  and  white text pages scanned with a flatbed scanner
78              and is faster than the default method  that  iteratively  deter‐
79              mines the thresholding value first.
80
81
82       -local=widthxheight
83              This  selects local adaptive thresholding (also known as dynamic
84              thresholding) using the neighborhood of width and height  around
85              every  pixel.   pamthreshold computes the threshold individually
86              for each pixel of the  image.   This  can  accommodate  changing
87              lighting  conditions in the image.  Depending on the size of the
88              neighborhood this can be quite slow.
89
90
91       -dual=widthxheight
92              This selects  a  dual  thresholding  algorithm  using  a  global
93              threshold  for low contrast neighborhoods and local thresholding
94              otherwise.  This can preserve larger  back-  respectively  fore‐
95              ground  areas  than local adaptive thresholding.  This algorithm
96              was proposed in the paper "An Approach To Licence Plate Recogni‐
97              tion" by J.R. Parker and Pavol Federl.
98
99
100       -threshold=threshold
101              This  sets the thresholding value for simple or local threshold‐
102              ing.  The value is a floating point number in the range  [0,  1]
103              directly  proportional to the Netpbm sample values, where 0 cor‐
104              responds to black and 1 to the maxval of the image.
105
106              If you don't specify this option, pamthreshold uses a  threshold
107              of 0.5.  Without -simple or -local this option is meaningless.
108
109              The meaning of the threshold depends upon the kind of threshold‐
110              ing you do (as determined by other options).  Roughly, pixels at
111              least  as  bright  as  the  threshold become white in the output
112              while others become black.
113
114
115       -contrast=threshold
116              This sets the threshold to determine if a neighborhood  has  low
117              contrast  or not for dual thresholding.  The value is a floating
118              point number in the range [0, 1].
119
120              If you don't specify this option, pamthreshold uses  a  contrast
121              threshold of 0.05.  Without -dual this option is meaningless.
122
123
124
125
126

SEE ALSO

128       pamditherbw(1), ppmtopgm(1), pamtopnm(1), pam(1)
129
130

HISTORY

132       pamthreshold was new in Netpbm 10.34 (June 2006).
133
134

AUTHOR

136       pamthreshold  is  Copyright © 2006 by Erik Auerswald and released under
137       the GPL(1).
138
139
140
141netpbm documentation             06 June 2007      Pamthreshold User Manual(0)
Impressum