\ .\" This man page was generated by the Netpbm tool 'makeman' from HTML source. .\" Do not hand-hack it! If you have bug fixes or improvements, please find .\" the corresponding HTML page on the Netpbm website, generate a patch .\" against that, and send it to the Netpbm maintainer. .TH "Pgmmedian User Manual" 1 "20 January 2022" "netpbm documentation" .SH NAME pgmmedian - apply a median filter to a PGM file .UN synopsis .SH SYNOPSIS \fBpgmmedian\fP [\fB-width=\fP\fIn\fP] [\fB-height=\fP\fIn\fP] [\fB-type=\fP\fImedian_type\fP] [\fB-cutoff=\fP\fIint\fP] [\fIpnmfile\fP] .PP 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. .UN description .SH DESCRIPTION .PP This program is part of .BR "Netpbm" (1)\c \&. .PP \fBpgmmedian\fP applies a median filter to a PGM image, using either the histogram sort or select kth value method to determine the median. .PP 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. .PP 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 \fB-height\fP is 9, the first 4 and last 4 rows of the input image are just copied to the output. .PP See the \fB-type\fP and \fB-cutoff\fP options for information on how \fBpgmmedian\fP chooses between the two methods. .UN options .SH OPTIONS .PP In addition to the options common to all programs based on libnetpbm (most notably \fB-quiet\fP, see .UR index.html#commonoptions Common Options .UE \&), \fBpgmmedian\fP recognizes the following command line options: .TP \fB-cutoff\fP \fIint\fP This option provides the cutoff value that \fBpgmmedian\fP uses to decide between using the histogram sort or select kth value method to find the median. If (\fImaxval\fP / ((\fIwidth\fP * \fIheight\fP) - 1)), where \fImaxval\fP is the maxval of the image and \fIwidth\fP and \fIheight\fP are the dimensions of the mask, is less than the cutoff value, \fBpgmmedian\fP uses histogram sort. Otherwise, it uses kth value. .sp This option has no effect if you specify \fB-type\fP. .sp The default is 250 .TP \fB-width=\fP\fIn\fP Width of the median mask to apply. .sp Maximum allowed is the width of the input image. .sp Default is 3. .TP \fB-height=\fP\fIn\fP Height of the median mask to apply. .sp Maximum allowed is the height of the input image. .sp Default is 3. .TP \fB-type\fP \fImedian_type\fP This option selects which method to use to find median regardless of cutoff value. Choices are \fBhistogram_sort\fP and \fBselect\fP. .sp By default, \fBpgmmedian\fP decides which method to use as described under the \fB-cutoff\fP option. .UN references .SH REFERENCES .IP \(bu "Collected Algorithms from ACM" Volume II, Algorithm 489 by Robert W. Floyd .IP \(bu "A Fast Two-Dimensional Median Filtering Algorithm" in "IEEE Transactions on Acoustics, Speech, and Signal Processing" Vol. ASSP-27, No. 1, February 1979 .IP \(bu "Digital Image Processing Algorithms" by Ioannis Pitas, Prentice Hall, 1993 ISBN 0-13-145814-0 .UN seealso .SH SEE ALSO .BR "pgmnoise" (1)\c \&, .BR "pamaddnoise" (1)\c \&, .BR "pnmconvol" (1)\c \&, .BR "pgmmorphconv" (1)\c \&, .BR "pgm" (1)\c \& .UN history .SH HISTORY .PP \fBpgmmedian\fP was added to Netpbm in Version 10.29 (August 2005). It had been distributed by Mike Burns via his own web site before that (and continued to be so). .UN author .SH AUTHOR Copyright (C) 1996 by Mike Burns <\fIburns@cac.psu.edu\fP> .SH DOCUMENT SOURCE This manual page was generated by the Netpbm tool 'makeman' from HTML source. The master documentation is at .IP .B http://netpbm.sourceforge.net/doc/pgmmedian.html .PP