about summary refs log tree commit diff
path: root/pgmkernel.html
blob: a0bdaaae59fb4d79518e2d59e2ae2f868cf322c5 (plain) (blame)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE>Pgmkernel User Manual</TITLE></HEAD>
<BODY>
<H1>pgmkernel</H1>
Updated: 19 December 2013
<BR>
<A HREF="#index">Table Contents</A>

<H2>NAME</H2>

pgmkernel - generate a convolution kernel

<H2 id="synopsis">SYNOPSIS</H2>

<p>
<B>pgmkernel</B> [<B>-weight</B> <I>number</I>] <I>size</I>

<p>
<B>pgmkernel</B> [<B>-weight</B> <I>number</I>] <I>width</I> <I>height</I>

<H2 id="description">DESCRIPTION</H2>

<p>This program is part of <a href="index.html">Netpbm</a>.

<p><b>pgmkernel</b> generates a convolution kernel that you can use
with <b>pnmconvol</b>.  The kernel is one where the weight of each location
is inversely proportional to its distance from the center of the kernel.

<p><b>pgmkernel</b> generates a PGM image of width and height <I>size</I>
if you specify one argument, or width <i>width</i> and height <i>height</i>
if you specify two arguments.

<p><b>pgmkernel</b> computes the convolution function K as follows.

<blockquote>
K(i,j) = 1 / ( 1 + w * sqrt(i^2 + j^2)) 
</blockquote>

where <I>w</I> is a coefficient specified via the <b>-weight</b>
option.  <i>i</i> and <i>j</i> are measured in pixels.  K is zero
everywhere beyond the specified kernel width and height.

<p>The sample values in the PGM output have this value scaled and biased using
the protocol <b>pnmconvol</b> specifies for representing the real numbers K
in PGM.

<H2 id="options">OPTIONS</H2>

The optional <b>-weight</b> value must be a positive real number.  The default
value is 6.0.

<h2 id="limitations">LIMITATIONS</H2>

<P>The computation time is proportional to <I>width</I>*<I>height</I>.
This increases rapidly with the increase of the kernel size.  A better
approach could be using a FFT in these cases.

<h2 id="history">HISTORY</h2>

<p>Before Netpbm 10.65 (December 2013), the output was always in
Plain (text) PGM format.  (Now, like standard Netpbm programs, the default
is raw PGM and you can get Plain PGM with a <b>-plain</b> option).

<p>Before Netpbm 10.65 (December 2013), this manual said negative values
for <b>-weight</b> were valid (as long as they were greater than -1.0).  But
the program never worked with negative numbers and it isn't clear that the
result would be useful, so <b>-weight</b> is now required to be nonnegative
and the program fails gracefully if you specify a negative value.

<H2 id="seealso">SEE ALSO</H2>

<A HREF="pnmconvol.html">pnmconvol</A>,
<A HREF="pnmsmooth.html">pnmsmooth</A>
<A HREF="pamgauss.html">pamgauss</A>
<A HREF="pgm.html">pgm</A>


<H2 id="author">AUTHOR</H2>

Alberto Accomazzi (<A
HREF="mailto:alberto@cfa.harvard.edu">alberto@cfa.harvard.edu</A>).


<HR>
<H2 id="index">Table Of Contents</H2>
<UL>
<LI><A HREF="#synopsis">SYNOPSIS</A>
<LI><A HREF="#description">DESCRIPTION</A>
<LI><A HREF="#options">OPTIONS</A>
<LI><A HREF="#limitations">LIMITATIONS</A>
<LI><A HREF="#history">HISTORY</A>
<LI><A HREF="#seealso">SEE ALSO</A>
<LI><A HREF="#author">AUTHOR</A>
</UL>
</BODY>
</HTML>