pgmmedian1
Apply a median filter to a pgm file
Usage
pgmmedian
[-width=n]
[-height=n]
[-type=median_type]
[-cutoff=int]
[pnmfile]
Minimum unique abbreviation of option is acceptable. You may use double hyphens instead of single hyphen to denote options. You may use white space in place of the equals sign to separate an option name from its value.
Overview
This program is part of Netpbm(1) .
pgmmedian applies a median filter to a PGM image, using either the histogram sort or select kth value method to determine the median.
A median filter is a convolution filter in which the value of a pixel in the output is the median of a certain set of pixels in the neighborhood of the corresponding input pixel. The effect is to eliminate locally extreme values. Such pixels typically show up as speckles.
Pixels at the edges of the image, pixels where the convolution kernel would go off the edge of the image, are just copied. For example, if -height is 9, the first 4 and last 4 rows of the input image are just copied to the output.
See the -type and -cutoff options for information on how pgmmedian chooses between the two methods.
Options
In addition to the options common to all programs based on libnetpbm (most notably -quiet, see
Common Options ⟨index.html#commonoptions⟩ ), pgmmedian recognizes the following command line options:
-
-cutoff int -
This option provides the cutoff value that
pgmmedianuses to decide between using the histogram sort or select kth value method to find the median.If (maxval / ((width * height) - 1)), where maxval is the maxval of the image and width and height are the dimensions of the mask, is less than the cutoff value,
pgmmedianuses histogram sort. Otherwise, it uses kth value.This option has no effect if you specify
-type.The default is 250
-
-width=n -
Width of the median mask to apply.
Maximum allowed is the width of the input image.
Default is 3.
-
-height=n -
Height of the median mask to apply.
Maximum allowed is the height of the input image.
Default is 3.
-
-type median_type -
This option selects which method to use to find median regardless of cutoff value. Choices are
histogram_sortandselect.By default,
pgmmediandecides which method to use as described under the-cutoffoption.
References
- •
-
"Collected Algorithms from ACM" Volume II, Algorithm 489 by Robert W. Floyd
- •
-
"A Fast Two-Dimensional Median Filtering Algorithm" in "IEEE Transactions on Acoustics, Speech, and Signal Processing" Vol. ASSP-27, No. 1, February 1979
- •
-
"Digital Image Processing Algorithms" by Ioannis Pitas, Prentice Hall, 1993 ISBN 0-13-145814-0
Document source
This manual page was generated by the Netpbm tool 'makeman' from HTML source. The master documentation is at
-
http://netpbm.sourceforge.net/doc/pgmmedian.html
Releases
3 releases since Debian 12 (Bookworm); the text changed 1 time.