| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN"> |
| 2 |
<html><head><title>Pgmmedian User Manual</title></head> |
| 3 |
<body> |
| 4 |
<h1>pgmmedian</h1> |
| 5 |
Updated: 20 January 2022 |
| 6 |
<br> |
| 7 |
<a href="#index">Table Of Contents</a> |
| 8 |
|
| 9 |
<h2>NAME</h2> |
| 10 |
pgmmedian - apply a median filter to a PGM file |
| 11 |
|
| 12 |
<h2 id="synopsis">SYNOPSIS</h2> |
| 13 |
|
| 14 |
<b>pgmmedian</b> |
| 15 |
|
| 16 |
[<b>-width=</b><i>n</i>] |
| 17 |
|
| 18 |
[<b>-height=</b><i>n</i>] |
| 19 |
|
| 20 |
[<b>-type=</b><i>median_type</i>] |
| 21 |
|
| 22 |
[<b>-cutoff=</b><i>int</i>] |
| 23 |
|
| 24 |
[<i>pnmfile</i>] |
| 25 |
|
| 26 |
|
| 27 |
<p>Minimum unique abbreviation of option is acceptable. You may use double |
| 28 |
hyphens instead of single hyphen to denote options. You may use white |
| 29 |
space in place of the equals sign to separate an option name from its value. |
| 30 |
|
| 31 |
|
| 32 |
<h2 id="description">DESCRIPTION</h2> |
| 33 |
|
| 34 |
<p>This program is part of <a href="index.html">Netpbm</a>. |
| 35 |
|
| 36 |
<p><b>pgmmedian</b> applies a median filter to a PGM image, using either |
| 37 |
the histogram sort or select kth value method to determine the median. |
| 38 |
|
| 39 |
<p>A median filter is a convolution filter in which the value of a pixel in |
| 40 |
the output is the median of a certain set of pixels in the neighborhood of the |
| 41 |
corresponding input pixel. The effect is to eliminate locally extreme values. |
| 42 |
Such pixels typically show up as speckles. |
| 43 |
|
| 44 |
<p>Pixels at the edges of the image, pixels where the convolution kernel would |
| 45 |
go off the edge of the image, are just copied. For example, if <b>-height</b> |
| 46 |
is 9, the first 4 and last 4 rows of the input image are just copied to the |
| 47 |
output. |
| 48 |
|
| 49 |
<p>See the <b>-type</b> and <b>-cutoff</b> options for information on |
| 50 |
how <b>pgmmedian</b> chooses between the two methods. |
| 51 |
|
| 52 |
|
| 53 |
<h2 id="options">OPTIONS</h2> |
| 54 |
|
| 55 |
<p>In addition to the options common to all programs based on libnetpbm |
| 56 |
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions"> |
| 57 |
Common Options</a>), <b>pgmmedian</b> recognizes the following |
| 58 |
command line options: |
| 59 |
|
| 60 |
<dl compact> |
| 61 |
<dt><b>-cutoff</b> <i>int</i> |
| 62 |
|
| 63 |
<dd>This option provides the cutoff value that <b>pgmmedian</b> uses |
| 64 |
to decide between using the histogram sort or select kth value method |
| 65 |
to find the median. |
| 66 |
|
| 67 |
If (<i>maxval</i> / ((<i>width</i> * <i>height</i>) - 1)), where |
| 68 |
<i>maxval</i> is the maxval of the image and <i>width</i> and |
| 69 |
<i>height</i> are the dimensions of the mask, is less than the cutoff |
| 70 |
value, <b>pgmmedian</b> uses histogram sort. Otherwise, it uses kth |
| 71 |
value. |
| 72 |
|
| 73 |
<p>This option has no effect if you specify <b>-type</b>. |
| 74 |
|
| 75 |
<p>The default is 250 |
| 76 |
|
| 77 |
<dt><b>-width=</b><i>n</i> |
| 78 |
|
| 79 |
<dd>Width of the median mask to apply. |
| 80 |
|
| 81 |
<p>Maximum allowed is the width of the input image. |
| 82 |
|
| 83 |
<p>Default is 3. |
| 84 |
|
| 85 |
<dt><b>-height=</b><i>n</i> |
| 86 |
|
| 87 |
<dd>Height of the median mask to apply. |
| 88 |
|
| 89 |
<p>Maximum allowed is the height of the input image. |
| 90 |
|
| 91 |
<p>Default is 3. |
| 92 |
|
| 93 |
<dt><b>-type</b> <i>median_type</i> |
| 94 |
|
| 95 |
<dd>This option selects which method to use to find median regardless |
| 96 |
of cutoff value. Choices are <b>histogram_sort</b> and <b>select</b>. |
| 97 |
|
| 98 |
<p>By default, <b>pgmmedian</b> decides which method to use as described |
| 99 |
under the <b>-cutoff</b> option. |
| 100 |
|
| 101 |
</dl> |
| 102 |
|
| 103 |
<h2 id="references">REFERENCES</h2> |
| 104 |
|
| 105 |
<ul> |
| 106 |
|
| 107 |
<li>"Collected Algorithms from ACM" Volume II, Algorithm 489 |
| 108 |
by Robert W. Floyd |
| 109 |
|
| 110 |
<li>"A Fast Two-Dimensional Median Filtering Algorithm" in |
| 111 |
"IEEE Transactions on Acoustics, Speech, and Signal |
| 112 |
Processing" Vol. ASSP-27, No. 1, February 1979 |
| 113 |
|
| 114 |
<li>"Digital Image Processing Algorithms" by Ioannis |
| 115 |
Pitas, Prentice Hall, 1993 ISBN 0-13-145814-0 |
| 116 |
|
| 117 |
</ul> |
| 118 |
|
| 119 |
|
| 120 |
<h2 id="seealso">SEE ALSO</h2> |
| 121 |
|
| 122 |
<a href="pgmnoise.html">pgmnoise</a>, |
| 123 |
<a href="pamaddnoise.html">pamaddnoise</a>, |
| 124 |
<a href="pnmconvol.html">pnmconvol</a>, |
| 125 |
<a href="pgmmorphconv.html">pgmmorphconv</a>, |
| 126 |
<a href="pgm.html">pgm</a> |
| 127 |
|
| 128 |
<h2 id="history">HISTORY</h2> |
| 129 |
|
| 130 |
<p><b>pgmmedian</b> was added to Netpbm in Version 10.29 (August 2005). |
| 131 |
It had been distributed by Mike Burns via his own web site before that |
| 132 |
(and continued to be so). |
| 133 |
|
| 134 |
|
| 135 |
<h2 id="author">AUTHOR</h2> |
| 136 |
|
| 137 |
Copyright (C) 1996 by Mike Burns <<a |
| 138 |
href="mailto:[email protected]">[email protected]</a>> |
| 139 |
|
| 140 |
<hr> |
| 141 |
<h2 id="index">Table Of Contents</h2> |
| 142 |
<ul> |
| 143 |
<li><a href="#synopsis">SYNOPSIS</a> |
| 144 |
<li><a href="#description">DESCRIPTION</a> |
| 145 |
<li><a href="#options">OPTIONS</a> |
| 146 |
<li><a href="#references">REFERENCES</a> |
| 147 |
<li><a href="#seealso">SEE ALSO</a> |
| 148 |
<li><a href="#history">HISTORY</a> |
| 149 |
<li><a href="#author">AUTHOR</a> |
| 150 |
</ul> |
| 151 |
|
| 152 |
</body> |
| 153 |
</html> |