|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.media.jai.OperationDescriptorImpl
javax.media.jai.operator.ConvolveDescriptor
public class ConvolveDescriptor
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.
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. |
Name | Class Type | Default Value |
---|---|---|
kernel | javax.media.jai.KernelJAI | NO_PARAMETER_DEFAULT |
OperationDescriptor
,
KernelJAI
,
Serialized FormField Summary |
---|
Fields inherited from class javax.media.jai.OperationDescriptorImpl |
---|
sourceNames, supportedModes |
Fields inherited from interface javax.media.jai.OperationDescriptor |
---|
NO_PARAMETER_DEFAULT |
Constructor Summary | |
---|---|
ConvolveDescriptor()
Constructor. |
Method Summary | |
---|---|
static RenderedOp |
create(RenderedImage source0,
KernelJAI kernel,
RenderingHints hints)
Performs kernel-based convolution on an image. |
PropertyGenerator[] |
getPropertyGenerators()
Returns an array of PropertyGenerators implementing
property inheritance for the "Convolve" operation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConvolveDescriptor()
Method Detail |
---|
public PropertyGenerator[] getPropertyGenerators()
PropertyGenerators
implementing
property inheritance for the "Convolve" operation.
getPropertyGenerators
in interface OperationDescriptor
getPropertyGenerators
in class OperationDescriptorImpl
OperationDescriptorImpl.getPropertyGenerators(java.lang.String)
public static RenderedOp create(RenderedImage source0, KernelJAI kernel, RenderingHints hints)
Creates a ParameterBlockJAI
from all
supplied arguments except hints
and invokes
JAI.create(String,ParameterBlock,RenderingHints)
.
source0
- RenderedImage
source 0.kernel
- The convolution kernel.hints
- The RenderingHints
to use.
May be null
.
RenderedOp
destination.
IllegalArgumentException
- if source0
is null
.
IllegalArgumentException
- if kernel
is null
.JAI
,
ParameterBlockJAI
,
RenderedOp
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |