Class GradientMagnitudeDescriptor

All Implemented Interfaces:
OperationDescriptor, RegistryElementDescriptor, Serializable

public class GradientMagnitudeDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "GradientMagnitude" operation.

The "GradientMagnitude" operation is an edge detector which computes the magnitude of the image gradient vector in two orthogonal directions.

The result of the "GradientMagnitude" operation may be defined as:

 dst[x][y][b] = ((SH(x,y,b))^2 + (SV(x,y,b))^2 )^0.5
where SH(x,y,b) and SV(x,y,b) are the horizontal and vertical gradient images generated from band b of the source image by correlating it with the supplied orthogonal (horizontal and vertical) gradient masks. Origins set on the kernels will be ignored. The origins are assumed to be width/2 & height/2. It should be noted that this operation automatically adds a value of Boolean.TRUE for the JAI.KEY_REPLACE_INDEX_COLOR_MODEL to the given configuration so that the operation is performed on the pixel values instead of being performed on the indices into the color map if the source(s) have an IndexColorModel. This addition will take place only if a value for the JAI.KEY_REPLACE_INDEX_COLOR_MODEL has not already been provided by the user. Note that the configuration Map is cloned before the new hint is added to it. The operation can be smart about the value of the JAI.KEY_REPLACE_INDEX_COLOR_MODEL RenderingHints, i.e. while the default value for the JAI.KEY_REPLACE_INDEX_COLOR_MODEL is Boolean.TRUE, in some cases the operator could set the default.

Resource List
Name Value
GlobalName GradientMagnitude
LocallName GradientMagnitude
Description Performs gradient magnitude edge detection on an image.
Version 1.0
arg0Desc A gradient mask
arg1Desc A gradient mask orthogonal to the first one.

Parameter List
Name Class Type Default Value

See Also:
OperationDescriptor, KernelJAI, Serialized Form

Fields inherited from class
resources, sourceNames, supportedModes
Fields inherited from interface
Constructor Summary
          Constructor for the GradientMagnitudeDescriptor.
Method Summary
static RenderedOp create(RenderedImage source0, KernelJAI mask1, KernelJAI mask2, RenderingHints hints)
          Computes the gradient of an image
 PropertyGenerator[] getPropertyGenerators()
          Returns an array of PropertyGenerators implementing property inheritance for the "GradientMagnitude" operation.
protected  boolean validateParameters(ParameterBlock args, StringBuffer msg)
          Validates the input parameters.
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, 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 GradientMagnitudeDescriptor()
Constructor for the GradientMagnitudeDescriptor.
Method Detail


protected boolean validateParameters(ParameterBlock args,
                                     StringBuffer msg)
Validates the input parameters.

In addition to the standard checks performed by the superclass method, this method checks that "mask1" and "mask2" have the same dimensions.

validateParameters in class OperationDescriptorImpl
Following copied from class:
IllegalArgumentException - if args is null.
IllegalArgumentException - if msg is null and the validation fails.
See Also:
OperationDescriptorImpl.validateParameters(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)


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


public static RenderedOp create(RenderedImage source0,
                                KernelJAI mask1,
                                KernelJAI mask2,
                                RenderingHints hints)
Computes the gradient of an image

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

source0 - RenderedImage source 0.
mask1 - A gradient mask. May be null.
mask2 - A gradient mask orthogonal to the first one. May be null.
hints - The RenderingHints to use. May be null.
The RenderedOp destination.
IllegalArgumentException - if source0 is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp