Blame userguide/pammasksharpen.html

Packit 78deda
Packit 78deda
<HTML>
Packit 78deda
<HEAD><TITLE>Pammasksharpen User Manual</TITLE></HEAD>
Packit 78deda
<BODY>
Packit 78deda

pammasksharpen

Packit 78deda
Updated: 14 June 2006
Packit 78deda

Packit 78deda
Table Of Contents
Packit 78deda
Packit 78deda

NAME

Packit 78deda
pammasksharpen - Sharpen an image via an unsharp mask
Packit 78deda
Packit 78deda

SYNOPSIS

Packit 78deda
Packit 78deda
pammasksharpen
Packit 78deda
[-sharpness=realnum]
Packit 78deda
[-threshold=realnum]
Packit 78deda
maskfile [inputfile]
Packit 78deda
Packit 78deda

All options can be abbreviated to their shortest unique prefix.

Packit 78deda
You may use two hyphens instead of one.  You may separate an option
Packit 78deda
name and its value with white space instead of an equals sign.
Packit 78deda
Packit 78deda

EXAMPLES

Packit 78deda
Packit 78deda
Packit 78deda
   pamgauss 5 5 -sigma=.7 -tupletype=GRAYSCALE | pamtopnm >gauss.pgm
Packit 78deda
   pnmconvol -nooffset gauss.pgm myimage.ppm >blurred.ppm
Packit 78deda
   pammasksharpen blurred.ppm myimage.ppm >sharpened.ppm
Packit 78deda
Packit 78deda
Packit 78deda
Packit 78deda

DESCRIPTION

Packit 78deda
Packit 78deda

This program is part of Netpbm.

Packit 78deda
Packit 78deda

pammasksharpen reads a Netpbm image as input and produces a

Packit 78deda
sharpened version of it, in the same format, as output.  It does this
Packit 78deda
via an unsharp mask, which you supply as another Netpbm image.
Packit 78deda
Packit 78deda

An unsharp mask is generally a blurred version of the original

Packit 78deda
image.  The sharpening computation is this: Calculate the
Packit 78deda
"edgeness" of a sample in the input image as the signed
Packit 78deda
difference between the sample value and the corresponding sample in
Packit 78deda
the unsharp mask.  This tells how different the pixel is from its
Packit 78deda
neighbors.  Add a multiple of the edgeness to the original sample to
Packit 78deda
get the corresponding output sample.  Clip as necessary.  This causes
Packit 78deda
pixels that are brighter than their neighbors to get even brighter,
Packit 78deda
while pixels that are dimmer than their neighbors get even dimmer.
Packit 78deda
This makes edges -- places where pixel values change quickly in space
Packit 78deda
-- stand out more.
Packit 78deda
Packit 78deda

The unsharp mask must be the same dimensions and have the same maxval

Packit 78deda
as the input image.
Packit 78deda
Packit 78deda

The Unsharp Mask

Packit 78deda
Packit 78deda

You usually create the unsharp mask as a Gaussian blur of the

Packit 78deda
original image, which you can do using pamgauss and
Packit 78deda
pnmconvol as in the example above.  The convolution kernel you
Packit 78deda
use with pnmconvol is normally a square with side length an odd
Packit 78deda
number of pixels.
Packit 78deda
Packit 78deda

When you create an unsharp mask like this, you will have to choose

Packit 78deda
the side length of the convolution kernel.  That length implements the
Packit 78deda
parameter of unsharp mask sharpening usually known as
Packit 78deda
"radius."  In particular, a radius of R pixels corresponds to a 
Packit 78deda
convolution kernel 2R+1 pixels on a side.
Packit 78deda
Packit 78deda

Radius is a very important parameter; you can ruin an image with a

Packit 78deda
radius too large.  You can safely use the highest radius with an
Packit 78deda
inanimate object, while a human face demands the least.  Landscapes
Packit 78deda
fall in between.  But it really depends on the size of the details.
Packit 78deda
Fine detail needs a smaller radius, or else you may obliterate tiny
Packit 78deda
detail of the same size as the Radius width.  A large image often has
Packit 78deda
larger detail (more pixels involved), so can use a larger radius.
Packit 78deda
Radius and sharpness (see -sharpness option) interact: reducing
Packit 78deda
one allows you to increase the other.
Packit 78deda
Packit 78deda

OPTIONS

Packit 78deda
Packit 78deda
Packit 78deda
Packit 78deda
-sharpness=realnum
Packit 78deda
Packit 78deda
This specifies the magnitude of the sharpening. It is the multiple
Packit 78deda
of edgeness that gets added to each sample as described above.
Packit 78deda
Packit 78deda

realnum is a nonnegative real decimal number. Zero means

Packit 78deda
no sharpening at all.
Packit 78deda
Packit 78deda

This parameter is known as "amount" in ImageMagick.

Packit 78deda
Packit 78deda

The default is 1.0.

Packit 78deda
Packit 78deda

This option was new in Netpbm 10.30 (October 2005). Before that,

Packit 78deda
the sharpness was always 1.0.
Packit 78deda
Packit 78deda
-threshold=realnum
Packit 78deda
Packit 78deda
This minimum amount of edgeness that will be considered edgeness
Packit 78deda
at all.  i.e. if the magnitude of the edgeness is less than this,
Packit 78deda
pammasksharpen will treat the edgeness as zero.
Packit 78deda
Packit 78deda

A nonzero value may be necessary here to avoid speckling in smooth

Packit 78deda
areas.
Packit 78deda
Packit 78deda

This is a fraction of the maxval (so it is in the range [0, 1.0]).

Packit 78deda
Packit 78deda

The default is 0.

Packit 78deda
Packit 78deda

This option was new in Netpbm 10.34 (June 2006).

Packit 78deda
Packit 78deda
Packit 78deda
Packit 78deda

SEE ALSO

Packit 78deda
Packit 78deda
pnmconvol,
Packit 78deda
pamedge,
Packit 78deda
pamsharpness,
Packit 78deda
pamsharpmap,
Packit 78deda
pamarith,
Packit 78deda
pnm,
Packit 78deda
pam
Packit 78deda
Packit 78deda
Packit 78deda

HISTORY

Packit 78deda
Packit 78deda

pammasksharpen was new in Netpbm 10.23 (July 2004).

Packit 78deda
Packit 78deda

Packit 78deda

Table Of Contents

Packit 78deda
    Packit 78deda
  • SYNOPSIS
  • Packit 78deda
  • DESCRIPTION
  • Packit 78deda
  • HISTORY
  • Packit 78deda
  • SEE ALSO
  • Packit 78deda
    Packit 78deda
    </BODY>
    Packit 78deda
    </HTML>