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

NAME

6       pnmnlfilt  - non-linear filters: smooth, alpha trim mean, optimal esti‐
7       mation smoothing, edge enhancement.
8
9

SYNOPSIS

11       pnmnlfilt alpha radius [pnmfile]
12
13

DESCRIPTION

15       This program is part of Netpbm(1).
16
17       pnmnlfilt produces an output image where the pixels are  a  summary  of
18       multiple pixels near the corresponding location in an input image.
19
20       This program works on multi-image streams.
21
22       This  is  something  of  a  swiss army knife filter.  It has 3 distinct
23       operating modes.  In all of the modes pnmnlfilt examines each pixel  in
24       the  image  and processes it according to the values of it and its sur‐
25       rounding pixels.  Rather than using a square block of surrounding  pix‐
26       els  (e.g.  the  subject  pixel and its 8 immediate neighbors, in a 3x3
27       square), pnmnlfilt uses 7 hexagonal areas.  You choose the size of  the
28       hexagons  with  the radius parameter.  A radius value of 1/3 means that
29       the 7 hexagons essentially fit into the subject pixel (ie.  there  will
30       be  no  filtering  effect).   A  radius  value  of 1.0 means that the 7
31       hexagons essentially cover the 3x3 immediate neighbor square.
32
33       Your choice of "alpha" parameter selects among the three modes.
34
35
36   Alpha trimmed mean filter (0.0 <= alpha <= 0.5)
37       The value of the center pixel will be replaced by the  mean  of  the  7
38       hexagon  values,  but  the  7 values are sorted by size and the top and
39       bottom alpha portion of the 7 are excluded from the mean.  This implies
40       that  an  alpha  value of 0.0 gives the same sort of output as a normal
41       convolution (ie. averaging or  smoothing  filter),  where  radius  will
42       determine  the "strength" of the filter. A good value to start from for
43       subtle filtering is alpha = 0.0, radius  =  0.55  For  a  more  blatant
44       effect, try alpha 0.0 and radius 1.0
45
46       An  alpha value of 0.5 will cause the median value of the 7 hexagons to
47       be used to replace the center pixel value. This sort of filter is  good
48       for  eliminating  "pop"  or  single  pixel  noise from an image without
49       spreading the noise out or smudging features on  the  image.  Judicious
50       use  of the radius parameter will fine tune the filtering. Intermediate
51       values of alpha give effects  somewhere  between  smoothing  and  "pop"
52       noise reduction. For subtle filtering try starting with values of alpha
53       = 0.4, radius = 0.6 For a more blatant effect try alpha = 0.5, radius =
54       1.0
55
56
57   Optimal estimation smoothing. (1.0 <= alpha <= 2.0)
58       This  type  of  filter  applies  a smoothing filter adaptively over the
59       image.  For each pixel the variance of the surrounding  hexagon  values
60       is  calculated,  and  the amount of smoothing is made inversely propor‐
61       tional to it. The idea is that if the variance is small then it is  due
62       to noise in the image, while if the variance is large, it is because of
63       "wanted" image features. As usual the  radius  parameter  controls  the
64       effective radius, but it probably advisable to leave the radius between
65       0.8 and 1.0 for the variance calculation to be meaningful.   The  alpha
66       parameter  sets  the noise threshold, over which less smoothing will be
67       done.  This means that small values of alpha will give the most  subtle
68       filtering  effect,  while large values will tend to smooth all parts of
69       the image. You could start with values like alpha = 1.2, radius  =  1.0
70       and try increasing or decreasing the alpha parameter to get the desired
71       effect. This type of filter is best for filtering out  dithering  noise
72       in both bitmap and color images.
73
74
75   Edge enhancement. (-0.1 >= alpha >= -0.9)
76       This  is  the  opposite  type  of  filter  to  the smoothing filter. It
77       enhances edges.  The  alpha  parameter  controls  the  amount  of  edge
78       enhancement, from subtle (-0.1) to blatant (-0.9). The radius parameter
79       controls the effective radius as usual, but useful values  are  between
80       0.5 and 0.9. Try starting with values of alpha = 0.3, radius = 0.8
81
82
83   Combination use.
84       The  various  modes of pnmnlfilt can be used one after the other to get
85       the desired result. For instance to turn a  monochrome  dithered  image
86       into a grayscale image you could try one or two passes of the smoothing
87       filter, followed by a pass of the optimal estimation filter, then  some
88       subtle  edge  enhancement.  Note  that  using  edge enhancement is only
89       likely to be useful after one of the non-linear filters (alpha  trimmed
90       mean  or  optimal estimation filter), as edge enhancement is the direct
91       opposite of smoothing.
92
93       For reducing color quantization noise in images (ie. turning .gif files
94       back  into 24 bit files) you could try a pass of the optimal estimation
95       filter (alpha 1.2, radius 1.0), a pass of the median filter (alpha 0.5,
96       radius 0.55), and possibly a pass of the edge enhancement filter.  Sev‐
97       eral passes of the optimal estimation filter with declining alpha  val‐
98       ues are more effective than a single pass with a large alpha value.  As
99       usual, there is a tradeoff between filtering effectiveness  and  losing
100       detail. Experimentation is encouraged.
101
102

References:

104       The  alpha-trimmed mean filter is based on the description in IEEE CG&A
105       May 1990 Page 23 by Mark E. Lee and Richard A.  Redner,  and  has  been
106       enhanced to allow continuous alpha adjustment.
107
108       The  optimal  estimation  filter  is  taken from an article "Converting
109       Dithered Images Back to Gray Scale" by Allen Stenger, Dr  Dobb's  Jour‐
110       nal, November 1992, and this article references "Digital Image Enhance‐
111       ment and Noise Filtering by Use of  Local  Statistics",  Jong-Sen  Lee,
112       IEEE  Transactions  on Pattern Analysis and Machine Intelligence, March
113       1980.
114
115       The edge enhancement details are from  pgmenhance(1),  which  is  taken
116       from  Philip  R.  Thompson's  "xim" program, which in turn took it from
117       section 6 of "Digital Halftones by Dot Diffusion",  D.  E.  Knuth,  ACM
118       Transaction  on Graphics Vol. 6, No. 4, October 1987, which in turn got
119       it from two 1976 papers by J. F. Jarvis et. al.
120
121
122
123
124       The parameters are:
125       alpha  The alpha value (described above), in  decimal.   May  be  frac‐
126              tional.
127
128
129       radius The radius (described above), in decimal.  May be fractional.
130
131
132

SEE ALSO

134       pgmenhance(1), pnmconvol(1), pnm(1)
135
136

AUTHOR

138       Graeme W. Gill graeme@labtam.oz.au
139

DOCUMENT SOURCE

141       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
142       source.  The master documentation is at
143
144              http://netpbm.sourceforge.net/doc/pnmnlfilt.html
145
146netpbm documentation            24 October 2006       Pnmnlfilt User Manual(0)
Impressum