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 -sharpness=realnum
72 This specifies the magnitude of the sharpening. It is the mul‐
73 tiple of edgeness that gets added to each sample as described
74 above.
75
76 realnum is a nonnegative real decimal number. Zero means no
77 sharpening at all.
78
79 This parameter is known as "amount" in ImageMagick.
80
81 The default is 1.0.
82
83 This option was new in Netpbm 10.30 (October 2005). Before
84 that, the sharpness was always 1.0.
85
86
87 -threshold=realnum
88 This minimum amount of edgeness that will be considered edgeness
89 at all. i.e. if the magnitude of the edgeness is less than
90 this, pammasksharpen will treat the edgeness as zero.
91
92 A nonzero value may be necessary here to avoid speckling in
93 smooth areas.
94
95 This is a fraction of the maxval (so it is in the range [0,
96 1.0]).
97
98 The default is 0.
99
100 This option was new in Netpbm 10.34 (June 2006).
101
102
103
104
106 pnmconvol(1), pamedge(1), pamsharpness(1), pamsharpmap(1), pamarith(1),
107 pnm(1), pam(1)
108
109
110
112 pammasksharpen was new in Netpbm 10.23 (July 2004).
113
115 This manual page was generated by the Netpbm tool 'makeman' from HTML
116 source. The master documentation is at
117
118 http://netpbm.sourceforge.net/doc/pammasksharpen.html
119
120netpbm documentation 14 June 2006 Pammasksharpen User Manual(0)