javax.media.jai.operator
Class UnsharpMaskDescriptor

java.lang.Object
  extended byjavax.media.jai.OperationDescriptorImpl
      extended byjavax.media.jai.operator.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

     where
      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
Vendor com.sun.media.jai
Description Performs unsharp masking to sharpen or smooth an image.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/UnsharpMaskDescriptor.html
Version 1.1
arg0Desc The convolution kernel.
arg1Desc The gain factor.

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

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

Field Summary
 
Fields inherited from class javax.media.jai.OperationDescriptorImpl
sourceNames, supportedModes
 
Fields inherited from interface javax.media.jai.OperationDescriptor
NO_PARAMETER_DEFAULT
 
Constructor Summary
UnsharpMaskDescriptor()
          Constructor.
 
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 javax.media.jai.OperationDescriptorImpl
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

UnsharpMaskDescriptor

public UnsharpMaskDescriptor()
Constructor.

Method Detail

getPropertyGenerators

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

Specified by:
getPropertyGenerators in interface OperationDescriptor
Overrides:
getPropertyGenerators in class OperationDescriptorImpl
Returns:
An array of property generators.
See Also:
OperationDescriptorImpl.getPropertyGenerators(java.lang.String)

create

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).

Parameters:
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.
Returns:
The RenderedOp destination.
Throws:
IllegalArgumentException - if source0 is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp