Penguin
Blame: pnmconvol(1)
EditPageHistoryDiffInfoLikePages
Annotated edit history of pnmconvol(1) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 pnmconvol
2 !!!pnmconvol
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 SEE ALSO
7 AUTHORS
8 ----
9 !!NAME
10
11
12 pnmconvol - general MxN convolution on a portable anymap
13 !!SYNOPSIS
14
15
16 __pnmconvol__ ''convolutionfile''
17 [[''pnmfile'']
18 !!DESCRIPTION
19
20
21 Reads two portable anymaps as input. Convolves the second
22 using the first, and writes a portable anymap as
23 output.
24
25
26 Convolution means replacing each pixel with a weighted
27 average of the nearby pixels. The weights and the area to
28 average are determined by the convolution matrix. The
29 unsigned numbers in the convolution file are offset by
30 -maxval/2 to make signed numbers, and then normalized, so
31 the actual values in the convolution file are only
32 relative.
33
34
35 Here is a sample convolution file; it does a simple average
36 of the nine immediate neighbors, resulting in a smoothed
37 image:
38
39
40 P2
41 3 3
42 18
43 10 10 10
44 10 10 10
45 10 10 10
46 To see how this works, do the above-mentioned offset: 10 - 18/2 gives 1. The possible range of values is from 0 to 18, and after the offset that's -9 to 9. The normalization step makes the range -1 to 1, and the values get scaled correspondingly so they become 1/9 - exactly what you want. The equivalent matrix for 5x5 smoothing would have maxval 50 and be filled with 26.
47
48
49 The convolution file will usually be a graymap, so that the
50 same convolution gets applied to each color component.
51 However, if you want to use a pixmap and do a different
52 convolution to different colors, you can certainly do
53 that.
54
55
56 At the edges of the convolved image, where the convolution
57 matrix would extend over the edge of the image,
58 __pnmconvol__ just copies the input pixels directly to
59 the output.
60 !!SEE ALSO
61
62
63 pnmsmooth(1), pnm(5)
64 !!AUTHORS
65
66
67 Copyright (C) 1989, 1991 by Jef Poskanzer.
68 Modified 26 November 1994 by Mike Burns,
69 burns@chem.psu.edu
70 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.