1Pammasksharpen User Manual(0) Pammasksharpen User Manual(0)
2
3
4
6 pammasksharpen - Sharpen an image via an unsharp mask
7
8
10 pammasksharpen [-sharpness=realnum] [-threshold=realnum] maskfile
11 [inputfile]
12
13 All options can be abbreviated to their shortest unique prefix. You
14 may use two hyphens instead of one. You may separate an option name
15 and its value with white space instead of an equals sign.
16
17
19 pamgauss 5 5 -sigma=.7 -tupletype=GRAYSCALE | pamtopnm > gauss.pgm
20 pnmconvol -nooffset gauss.pgm myimage.ppm > blurred.ppm
21 pammasksharpen blurred.ppm myimage.ppm > sharpened.ppm
22
23
24
26 This program is part of Netpbm(1).
27
28 pammasksharpen reads a Netpbm image as input and produces a sharpened
29 version of it, in the same format, as output. It does this via an
30 unsharp mask, which you supply as another Netpbm image.
31
32 An unsharp mask is generally a blurred version of the original image.
33 The sharpening computation is this: Calculate the "edgeness" of a sam‐
34 ple in the input image as the signed difference between the sample
35 value and the corresponding sample in the unsharp mask. This tells how
36 different the pixel is from its neighbors. Add a multiple of the edge‐
37 ness to the original sample to get the corresponding output sample.
38 Clip as necessary. This causes pixels that are brighter than their
39 neighbors to get even brighter, while pixels that are dimmer than their
40 neighbors get even dimmer. This makes edges -- places where pixel val‐
41 ues change quickly in space -- stand out more.
42
43 The unsharp mask must be the same dimensions and have the same maxval
44 as the input image.
45
46
47 The Unsharp Mask
48 You usually create the unsharp mask as a Gaussian blur of the original
49 image, which you can do using pamgauss and pnmconvol as in the example
50 above. The convolution kernel you use with pnmconvol is normally a
51 square with side length an odd number of pixels.
52
53 When you create an unsharp mask like this, you will have to choose the
54 side length of the convolution kernel. That length implements the
55 parameter of unsharp mask sharpening usually known as "radius." In
56 particular, a radius of R pixels corresponds to a convolution kernel
57 2R+1 pixels on a side.
58
59 Radius is a very important parameter; you can ruin an image with a
60 radius too large. You can safely use the highest radius with an inani‐
61 mate object, while a human face demands the least. Landscapes fall in
62 between. But it really depends on the size of the details. Fine
63 detail needs a smaller radius, or else you may obliterate tiny detail
64 of the same size as the Radius width. A large image often has larger
65 detail (more pixels involved), so can use a larger radius. Radius and
66 sharpness (see -sharpness option) interact: reducing one allows you to
67 increase the other.
68
69
71 In addition to the options common to all programs based on libnetpbm
72 (most notably -quiet, see
73 Common Options ⟨index.html#commonoptions⟩ ), pammasksharpen recognizes
74 the following command line options:
75
76
77
78
79 -sharpness=realnum
80 This specifies the magnitude of the sharpening. It is the mul‐
81 tiple of edgeness that gets added to each sample as described
82 above.
83
84 realnum is a nonnegative real decimal number. Zero means no
85 sharpening at all.
86
87 This parameter is known as "amount" in ImageMagick.
88
89 The default is 1.0.
90
91 This option was new in Netpbm 10.30 (October 2005). Before
92 that, the sharpness was always 1.0.
93
94
95 -threshold=realnum
96 This minimum amount of edgeness that will be considered edgeness
97 at all. i.e. if the magnitude of the edgeness is less than
98 this, pammasksharpen will treat the edgeness as zero.
99
100 A nonzero value may be necessary here to avoid speckling in
101 smooth areas.
102
103 This is a fraction of the maxval (so it is in the range [0,
104 1.0]).
105
106 The default is 0.
107
108 This option was new in Netpbm 10.34 (June 2006).
109
110
111
112
114 pnmconvol(1), pamedge(1), pamsharpness(1), pamsharpmap(1), pamarith(1),
115 pnm(1), pam(1)
116
117
118
120 pammasksharpen was new in Netpbm 10.23 (July 2004).
121
123 This manual page was generated by the Netpbm tool 'makeman' from HTML
124 source. The master documentation is at
125
126 http://netpbm.sourceforge.net/doc/pammasksharpen.html
127
128netpbm documentation 14 June 2006 Pammasksharpen User Manual(0)