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