Debian Codegraph @

userguide/pamgauss.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
2 <html><head><title>Pamgauss User Manual</title></head>
3 <body>
4 <h1>pamgauss</h1>
5 Updated: 18 May 2017
6 <br>
7 <a href="#index">Table Of Contents</a>
8
9 <h2>NAME</h2>
10 <b>pamgauss</b> - create a two-dimensional Gaussian function as a PAM image
11
12 <h2 id="synopsis">SYNOPSIS</h2>
13
14 <b>pamgauss</b>
15 <i>width</i>
16 <i>height</i>
17 <b>-sigma=</b><i>number</i>
18 [<b>-maxval=</b><i>number</i>]
19 [<b>-tupletype=</b><i>string</i>]
20 [<b>-maximize</b>]
21 [<b>-oversample=</b><i>number</i>]
22
23
24 <p>Minimum unique abbreviation of option is acceptable. You may use double
25 hyphens instead of single hyphen to denote options. You may use white
26 space in place of the equals sign to separate an option name from its value.
27
28
29 <h2 id="examples">EXAMPLES</h2>
30
31 <pre>
32 pamgauss 7 7 -sigma=.5 -maximize -tupletype=GRAYSCALE | pamtopnm &gt;gauss.pgm
33 pnmconvol -nooffset -normalize gauss.pgm myimage.ppm &gt;blurred.ppm
34 </pre>
35
36 <h2 id="description">DESCRIPTION</h2>
37
38 <p>This program is part of <a href="index.html">Netpbm</a>.
39
40 <p><b>pamgauss</b> generates a one-plane PAM image whose samples are a
41 Gaussian function of their distance from the center of the image. I.e.
42 the sample value is highest in the center and goes down, in a bell curve
43 shape, as you move away from the center.
44
45 <p>You can use this image as a convolution kernel with
46 <b>pnmconvol</b> to blur an image. (This technique is known as
47 Gaussian blurring).
48
49 <i>width</i> and <i>height</i> are the dimensions of the image that
50 <b>pamgauss</b> generates. Mathematically speaking, they are the domain of
51 the two-dimensional Gaussian function. If you want to be sure you get a whole
52 Gaussian function, make sure that you choose a standard deviation and image
53 dimensions so that if you made it any larger, the sample values at the edges
54 would be zero.
55
56 <p>The output image is PAM. To make it usable with <b>pnmconvol</b>,
57 specify <b>-tupletype=GRAYSCALE</b> so <b>pnmconvol</b> can use it as
58 if it were PGM. You must use the <b>-nooffset</b> option on
59 <b>pnmconvol</b> because zero means zero in the PAM that
60 <b>pamgauss</b> generates.
61
62 <p>Without <b>-maximize</b>, the sum of all the samples is equal to the
63 image's maxval (within rounding error). This is true even if you clip the
64 Gaussian function by making the image too small. This is what is normally
65 required of a convolution kernel.
66
67 <p><b>pamgauss</b> oversamples and averages to represent the continuous
68 Gaussian function in discrete samples in the PAM output. Consider an image 11
69 samples wide and an oversampling factor of 10. The samples can be thought of
70 as contiguous squares one unit wide. The center of the image is thus the
71 center of the 6th sample from the left. The 3rd sample from the left covers a
72 range of distances from 3 to 4 units from the center of the image. Because
73 the oversampling factor is 10, <b>pamgauss</b> computes the value of the
74 Gaussian function at 10 points evenly spaced between 3 and 4 units from the
75 center of the image and assigns the 3rd sample from the left the mean of those
76 10 values.
77
78
79 <h2 id="options">OPTIONS</h2>
80
81 <p>In addition to the options common to all programs based on libnetpbm
82 (most notably <b>-quiet</b>, see <a href="index.html#commonoptions">
83 Common Options</a>), <b>pamgauss</b> recognizes the following
84 command line options:
85
86 <dl>
87 <dt><b>-sigma=</b><i>number</i>
88
89 <dd>This is the standard deviation of the Gaussian function. The higher the
90 number, the more spread out the function is. Normally, you want to make this
91 number low enough that the function reaches zero value before the edge of your
92 image.
93
94 <p><i>number</i> is in units of samples.
95
96 <p>This option is required. There is no default.
97
98 <dt><b>-maximize</b>
99 <dd>Causes <b>pamgauss</b> to use the whole dynamic range available in
100 the output PAM image by choosing an amplitude for the Gaussian function that
101 causes the maximum value in the image to be the maxval of the image.
102 <p>
103 If you select this, you probably want to normalize the output (scale the
104 samples down so the volume under the surface of the two-dimensional Gaussian
105 function is the maxval) before you use it, for example with
106 <b>pnmconvol</b>'s <b>-normalize</b> option. The reason this is different
107 from just not using <b>-maximize</b> is that this subsequent normalization can
108 be done with much more precision than can be represented in a PAM image.
109 <p>
110 Without this option, <b>pamgauss</b> uses an amplitude that makes the volume
111 under the surface of the two-dimensional Gaussian function the maxval of the
112 image. This means all the samples in the image are normally considerably less
113 than the maxval.
114
115 <p>This option was new in Netpbm 10.79 (June 2017).
116
117 <dt><b>-maxval=</b><i>number</i>
118 <dd>This is the maxval for the output image. 65535 is almost always the best
119 value to use. But there may be some programs (not part of Netpbm) that can't
120 handle a maxval greater than 255.
121
122 <p>The default is 255.
123
124 <dt><b>-tupletype=</b><i>string</i>
125 <dd>
126 This is the value of the "tuple_type" attribute of the created PAM image.
127 It can be any string up to 255 characters.
128
129 <p>If you don't specify this, <b>pamgauss</b> generates a PAM with unspecified
130 tuple type.
131
132 <dt><b>-oversample=</b><i>number</i>
133 <dd>
134 This sets the oversampling factor. <b>pamgauss</b> samples the Gaussian
135 function this many times, both horizontally and vertically, to get the value
136 of each sample in the output.
137
138 <p>An oversampling factor of 1 means no oversampling, which means each
139 sample is based only on the value of the Gaussian function at the center of
140 the sample.
141
142 <p>The default is 5 divided by the standard deviation, rounded up to a whole
143 number.
144
145 <p>This option was new in Netpbm 10.79 (June 2017). Before that, it is
146 essentially 1 - there is no oversampling.
147
148 </dl>
149
150 <h2 id="seealso">SEE ALSO</h2>
151
152 <b><a href="pnmconvol.html">pnmconvol</a></b>,
153 <b><a href="pamtopnm.html">pamtopnm</a></b>,
154 <b><a href="pgmkernel.html">pgmkernel</a></b>,
155 <b><a href="pamseq.html">pamseq</a></b>,
156 <b><a href="pam.html">pam</a></b>
157
158 <h2 id="history">HISTORY</h2>
159
160 <p><b>pamgauss</b> was new in Netpbm 10.23 (July 2004).
161
162 <hr>
163 <h2 id="index">Table Of Contents</h2>
164 <ul>
165 <li><a href="#synopsis">SYNOPSIS</a>
166 <li><a href="#examples">EXAMPLES</a>
167 <li><a href="#description">DESCRIPTION</a>
168 <li><a href="#options">OPTIONS</a>
169 <li><a href="#seealso">SEE ALSO</a>
170 <li><a href="#history">HISTORY</a>
171 </ul>
172 </body>
173 </html>