An OperationDescriptor describing the "MaxFilter" operation.
The "MaxFilter" operation is a non-linear filter which is
useful for removing isolated lines or pixels while preserving the
overall appearance of an image. The filter is implemented by moving
a mask over the image. For each position of the mask, the
center pixel is replaced by the max of the pixel values covered
by the mask.
There are several shapes possible for the mask. The
MaxFilter operation supports three shapes, as follows:
Square Mask:
x x x
x x x
x x x
Plus Mask:
x
x x x
x
X Mask:
x x
x
x x
Example:
SeekableStream s = new FileSeekableStream(new File(imagefilename);
ParameterBlock pb = new ParameterBlock();
pb.add(s);
RenderedImage src = (RenderedImage)JAI.create("stream", pb);
pb = new ParameterBlock();
pb.addSource(src);
pb.add(MaxFilterDescriptor.MAX_MASK_PLUS); // mask Type
pb.add(new Integer(5)); // mask size
RenderedImage dst = (RenderedImage)JAI.create("maxfilter", pb);
A RenderingHints can also be added to the above.
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 | MaxFilter |
LocallName | MaxFilter |
Vendor | com.sun.media.jai |
Description | Performs max filtering on an image. |
DocURL | http://java.sun.com/products/java-media/jai/forDevelopers/jaiapi/javax.media.jai.operator.MaxFilterDescriptor.html |
Version | 1.0 |
arg0Desc | The shape of the mask to be used for Max Filtering. |
arg1Desc | The size (width/height) of the mask to be used in Max Filtering. |
Parameter List
Name | Class Type |
Default Value |
maskShape | javax.media.jai.operator.MaxFilterShape |
MAX_MASK_SQUARE |
maskSize | java.lang.Integer |
3 |
See Also: javax.media.jai.OperationDescriptor See Also: MaxFilterShape since: JAI 1.1 |