Class UnsharpMaskDescriptor

All Implemented Interfaces:
OperationDescriptor, RegistryElementDescriptor, Serializable

public class UnsharpMaskDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "UnsharpMask" operation.

Unsharp masking is derived from a photographic technique for improving the sharpness of images. In its digital form it is implemented using convolution to create a low-pass filtered version of a source image. The low-pass image is then subtracted from the original image, creating a high-pass image. The high pass image is then added back to the original image, creating enhanced edge contrast. By adjusting a scaling factor, the degree of high pass add-back can be controlled.

The operation is implemented algorithmically as follows. At each original pixel location x,y:

    result = original + (original - lowpass) * gainFactor

      original = value at position x,y of source image
      lowpass  = result of convolution with lowpass filter
                 centered at pixel x,y
      gain     = controlling parameter for degree of sharpness
                   gain = 0 : no effect
                   gain > 0 : sharpening
                   -1 < gain < 0 : smoothing

In general gain factors should be restricted to a range of [-1, 2], as higher magnitude values are likely to cause overflows or underflows which must be clamped to the image data type's range.

The default gain factor is set to 1,0F.

This operation is widely applied to scanned image enhancement. The typical gain factor for scanned images takes values in the range of [1/4, 2] (page 278 in Digital Image Processing by William K. Pratt, 3rd).

Resource List
Name Value
GlobalName UnsharpMask
LocalName UnsharpMask
Description Performs unsharp masking to sharpen or smooth an image.
Version 1.1
arg0Desc The convolution kernel.
arg1Desc The gain factor.

Parameter List
Name Class Type Default Value
kernel 3 X 3 average
gain java.lang.Float 1.0F

JAI 1.1
See Also:
OperationDescriptor, KernelJAI, ConvolveDescriptor, Serialized Form

Fields inherited from class
resources, sourceNames, supportedModes
Fields inherited from interface
Constructor Summary
Method Summary
static RenderedOp create(RenderedImage source0, KernelJAI kernel, Float gain, RenderingHints hints)
          Performs UnsharpMask operation on the image.
 PropertyGenerator[] getPropertyGenerators()
          Returns an array of PropertyGenerators implementing property inheritance for the "UnsharpMask" operation.
Methods inherited from class
arePropertiesSupported, getDefaultSourceClass, getDestClass, getDestClass, getInvalidRegion, getName, getNumParameters, getNumSources, getParamClasses, getParamDefaults, getParamDefaultValue, getParameterListDescriptor, getParamMaxValue, getParamMinValue, getParamNames, getPropertyGenerators, getRenderableDestClass, getRenderableSourceClasses, getResourceBundle, getResources, getSourceClasses, getSourceClasses, getSourceNames, getSupportedModes, isImmediate, isModeSupported, isRenderableSupported, isRenderedSupported, makeDefaultSourceClassList, validateArguments, validateArguments, validateParameters, validateParameters, validateRenderableArguments, validateRenderableSources, validateSources, validateSources
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public UnsharpMaskDescriptor()
Method Detail


public PropertyGenerator[] getPropertyGenerators()
Returns an array of PropertyGenerators implementing property inheritance for the "UnsharpMask" operation.
getPropertyGenerators in class OperationDescriptorImpl
An array of property generators.


public static RenderedOp create(RenderedImage source0,
                                KernelJAI kernel,
                                Float gain,
                                RenderingHints hints)
Performs UnsharpMask operation on the image.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.create(String,ParameterBlock,RenderingHints).

source0 - RenderedImage source 0.
kernel - The low-pass convolution kernel. May be null.
gain - The sharpening value. May be null.
hints - The RenderingHints to use. May be null.
The RenderedOp destination.
IllegalArgumentException - if source0 is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp