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