summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-40/man1/pgmmedian.1
blob: a585420f55e5ecba49628958818fa69da8cff02b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
\
.\" 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" 0 "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