javax.media.jai.operator
Class GradientMagnitudeDescriptor

java.lang.Object
  |
  +--javax.media.jai.OperationDescriptorImpl
        |
        +--javax.media.jai.operator.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
Vendor com.sun.media.jai
Description Performs gradient magnitude edge detection on an image.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jaiapi/javax.media.jai.operator.GradientMagnitudeDescriptor.html
Version 1.0
arg0Desc A gradient mask
arg1Desc A gradient mask orthogonal to the first one.

Parameter List
Name Class Type Default Value
mask1 javax.media.jai.KernelJAI KernalJAI.GRADIENT_MASK_SOBEL_HORIZONTAL
mask2 javax.media.jai.KernelJAI KernalJAI.GRADIENT_MASK_SOBEL_VERTICAL

See Also:
OperationDescriptor, KernelJAI, Serialized Form

Fields inherited from class javax.media.jai.OperationDescriptorImpl
resources, sourceNames, supportedModes
 
Fields inherited from interface javax.media.jai.OperationDescriptor
NO_PARAMETER_DEFAULT
 
Constructor Summary
GradientMagnitudeDescriptor()
          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 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, validateRenderableArguments, validateRenderableSources, validateSources, validateSources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GradientMagnitudeDescriptor

public GradientMagnitudeDescriptor()
Constructor for the GradientMagnitudeDescriptor.
Method Detail

validateParameters

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.

Overrides:
validateParameters in class OperationDescriptorImpl
Following copied from class: javax.media.jai.OperationDescriptorImpl
Throws:
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)

getPropertyGenerators

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

create

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

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