1Pgmmedian User Manual(0) Pgmmedian User Manual(0)
2
3
4
6 pgmmedian - apply a median filter to a PGM file
7
8
10 pgmmedian
11
12 [-width=n]
13
14 [-height=n]
15
16 [-type=median_type]
17
18 [-cutoff=int]
19
20 [pnmfile]
21
22 Minimum unique abbreviation of option is acceptable. You may use dou‐
23 ble hyphens instead of single hyphen to denote options. You may use
24 white space in place of the equals sign to separate an option name from
25 its value.
26
27
28
30 This program is part of Netpbm(1).
31
32 pgmmedian applies a median filter to a PGM image, using either the his‐
33 togram sort or select kth value method to determine the median.
34
35 A median filter is a convolution filter in which the value of a pixel
36 in the output is the median of a certain set of pixels in the neighbor‐
37 hood of the corresponding input pixel. The effect is to eliminate lo‐
38 cally extreme values. Such pixels typically show up as speckles.
39
40 Pixels at the edges of the image, pixels where the convolution kernel
41 would go off the edge of the image, are just copied. For example, if
42 -height is 9, the first 4 and last 4 rows of the input image are just
43 copied to the output.
44
45
46 See the -type and -cutoff options for information on how pgmmedian
47 chooses between the two methods.
48
49
50
52 In addition to the options common to all programs based on libnetpbm
53 (most notably -quiet, see
54 Common Options ⟨index.html#commonoptions⟩ ), pgmmedian recognizes the
55 following command line options:
56
57
58
59 -cutoff int
60 This option provides the cutoff value that pgmmedian uses to de‐
61 cide between using the histogram sort or select kth value method
62 to find the median.
63
64 If (maxval / ((width * height) - 1)), where maxval is the maxval
65 of the image and width and height are the dimensions of the
66 mask, is less than the cutoff value, pgmmedian uses histogram
67 sort. Otherwise, it uses kth value.
68
69 This option has no effect if you specify -type.
70
71 The default is 250
72
73
74 -width=n
75 Width of the median mask to apply.
76
77 Maximum allowed is the width of the input image.
78
79 Default is 3.
80
81
82 -height=n
83 Height of the median mask to apply.
84
85 Maximum allowed is the height of the input image.
86
87 Default is 3.
88
89
90 -type median_type
91 This option selects which method to use to find median regard‐
92 less of cutoff value. Choices are histogram_sort and select.
93
94 By default, pgmmedian decides which method to use as described
95 under the -cutoff option.
96
97
98
99
101 • "Collected Algorithms from ACM" Volume II, Algorithm 489 by
102 Robert W. Floyd
103
104
105 • "A Fast Two-Dimensional Median Filtering Algorithm" in "IEEE
106 Transactions on Acoustics, Speech, and Signal Processing" Vol.
107 ASSP-27, No. 1, February 1979
108
109
110 • "Digital Image Processing Algorithms" by Ioannis Pitas, Prentice
111 Hall, 1993 ISBN 0-13-145814-0
112
113
114
115
116
118 pgmnoise(1), pamaddnoise(1), pnmconvol(1), pgmmorphconv(1), pgm(1)
119
120
122 pgmmedian was added to Netpbm in Version 10.29 (August 2005). It had
123 been distributed by Mike Burns via his own web site before that (and
124 continued to be so).
125
126
127
129 Copyright (C) 1996 by Mike Burns <burns@cac.psu.edu>
130
132 This manual page was generated by the Netpbm tool 'makeman' from HTML
133 source. The master documentation is at
134
135 http://netpbm.sourceforge.net/doc/pgmmedian.html
136
137netpbm documentation 20 January 2022 Pgmmedian User Manual(0)