Class XmlDescriptor

  • All Implemented Interfaces:
    Serializable, javax.media.jai.OperationDescriptor, javax.media.jai.RegistryElementDescriptor

    public class XmlDescriptor
    extends javax.media.jai.OperationDescriptorImpl
    An OperationDescriptor describing the "Convolve" operation.

    Convolution is a spatial operation that computes each output sample by multiplying elements of a kernel with the samples surrounding a particular source sample.

    For each destination sample, the kernel is rotated 180 degrees and its "key element," or origin, is placed over the source pixel corresponding with the destination pixel. The kernel elements are multiplied with the source pixels beneath them, and the resulting products are summed together to produce the destination sample value.

    Pseudocode for the convolution operation on a single sample dst[x][y] is as follows, assuming the kernel is of size width x height and has already been rotated through 180 degrees. The kernel's Origin element is located at position (xOrigin, yOrigin):

     dst[x][y] = 0;
     for (int i = -xOrigin; i < -xOrigin + width; i++) {
         for (int j = -yOrigin; j < -yOrigin + height; j++) {
             dst[x][y] += src[x + i][y + j]*kernel[xOrigin + i][yOrigin + j];
         }
     }
     

    Convolution, like any neighborhood operation, leaves a band of pixels around the edges undefined. For example, for a 3x3 kernel only four kernel elements and four source pixels contribute to the convolution pixel at the corners of the source image. Pixels that do not allow the full kernel to be applied to the source are not included in the destination image. A "Border" operation may be used to add an appropriate border to the source image in order to avoid shrinkage of the image boundaries.

    The kernel may not be bigger in any dimension than the image data.

    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 Convolve
    LocalName Convolve
    Vendor com.sun.media.jai
    Description Performs kernel-based convolution on an image.
    DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/ConvolveDescriptor.html
    Version 1.0
    arg0Desc The convolution kernel.
    Parameter List
    Name Class Type Default Value
    kernel javax.media.jai.KernelJAI NO_PARAMETER_DEFAULT
    See Also:
    OperationDescriptor, KernelJAI, 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

      Constructors 
      Constructor Description
      XmlDescriptor()
      Constructor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.media.jai.RenderedOp create​(URI location, Map<String,​Object> configuration, RenderingHints hints)
      Performs kernel-based convolution on an image.
      • Methods inherited from class javax.media.jai.OperationDescriptorImpl

        arePropertiesSupported, getDefaultSourceClass, getDestClass, getDestClass, getInvalidRegion, getName, getNumParameters, getNumSources, getParamClasses, getParamDefaults, getParamDefaultValue, getParameterListDescriptor, getParamMaxValue, getParamMinValue, getParamNames, getPropertyGenerators, getPropertyGenerators, getRenderableDestClass, getRenderableSourceClasses, getResourceBundle, getResources, getSourceClasses, getSourceClasses, getSourceNames, getSupportedModes, isImmediate, isModeSupported, isRenderableSupported, isRenderedSupported, makeDefaultSourceClassList, validateArguments, validateArguments, validateParameters, validateParameters, validateRenderableArguments, validateRenderableSources, validateSources, validateSources
    • Constructor Detail

      • XmlDescriptor

        public XmlDescriptor()
        Constructor.
    • Method Detail

      • create

        public static javax.media.jai.RenderedOp create​(URI location,
                                                        Map<String,​Object> configuration,
                                                        RenderingHints hints)
        Performs kernel-based convolution on an image.

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

        Parameters:
        location - The XML location.
        configuration - The configuration.
        hints - The RenderingHints to use. May be null.
        Returns:
        The RenderedOp destination.
        Throws:
        IllegalArgumentException - if source0 or function is null.
        See Also:
        JAI, ParameterBlockJAI, RenderedOp