org.jscience.computing.ai.vision
Class Filter

java.lang.Object
  extended by org.jscience.computing.ai.vision.Filter
Direct Known Subclasses:
BorderTracingOp, ConvolutionFilter, EqualizeFilter, GreyscaleFilter, InvertFilter, NoiseFilter, RankFilter, SobelEdgeDetectorFilter, ThresholdFilter

public abstract class Filter
extends java.lang.Object

This class provides abstract functionality for image processing filter operations.

Please note that this, as with the rest of the this JDK, is not intended as an all-inclusive, efficient or complete package. Instead, it is meant to facilitate easy understanding of core concepts and rapid web-demo development.


Constructor Summary
Filter()
           
 
Method Summary
 java.awt.image.BufferedImage filter(java.awt.image.BufferedImage image)
          Allows filter to be called with null as the output image by default.
abstract  java.awt.image.BufferedImage filter(java.awt.image.BufferedImage image, java.awt.image.BufferedImage output)
          Perform a filter operation.
 java.awt.image.BufferedImage verifyOutput(java.awt.image.BufferedImage output, java.awt.image.BufferedImage input)
          This method simply returns: verifyOutput(output, input, input.getWidth(), input.getHeight(), input.getType());

See #verifyOutput(BufferedImage,BufferedImage,int,int,int) for full details.

 java.awt.image.BufferedImage verifyOutput(java.awt.image.BufferedImage output, java.awt.image.BufferedImage input, int type)
          This method simply returns: verifyOutput(output, input, input.getWidth(), input.getHeight(), type);

See #verifyOutput(BufferedImage,BufferedImage,int,int,int) for full details.

 java.awt.image.BufferedImage verifyOutput(java.awt.image.BufferedImage output, int width, int height, int type)
          This method is designed to allow filters to verify the output image passed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filter

public Filter()
Method Detail

filter

public abstract java.awt.image.BufferedImage filter(java.awt.image.BufferedImage image,
                                                    java.awt.image.BufferedImage output)
Perform a filter operation. Note that your filter method should provide the necessary functionality to allow users to either pass an output image, or have own dynamically created if null is passed. This can be easily achieved using the verifyOutput methods provided.

Parameters:
output - the pre-allocated output image (optional).
image - the input image
Returns:
the output from the filter
See Also:
verifyOutput(BufferedImage,BufferedImage)

filter

public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage image)
Allows filter to be called with null as the output image by default. This was originally the way all calls to filter were achieved, but has been superceded with the new call to allow for more efficient handling of images.

Parameters:
image - the input image.
Returns:
the result of filter(image, null).

verifyOutput

public java.awt.image.BufferedImage verifyOutput(java.awt.image.BufferedImage output,
                                                 java.awt.image.BufferedImage input)
This method simply returns: verifyOutput(output, input, input.getWidth(), input.getHeight(), input.getType());

See #verifyOutput(BufferedImage,BufferedImage,int,int,int) for full details.

Parameters:
output - the current output image.
input - the input image.
Returns:
a valid output image.

verifyOutput

public java.awt.image.BufferedImage verifyOutput(java.awt.image.BufferedImage output,
                                                 java.awt.image.BufferedImage input,
                                                 int type)
This method simply returns: verifyOutput(output, input, input.getWidth(), input.getHeight(), type);

See #verifyOutput(BufferedImage,BufferedImage,int,int,int) for full details.

Parameters:
output - the current output image.
input - the input image.
type - the desired image type.
Returns:
a valid output image.

verifyOutput

public java.awt.image.BufferedImage verifyOutput(java.awt.image.BufferedImage output,
                                                 int width,
                                                 int height,
                                                 int type)
This method is designed to allow filters to verify the output image passed. The current design of Filter.filter allows for an optional output image to be passed. If the output image is not null, and meets the specified requirements, it is returned. Otherwise, this method creates a valid image and returns that.

For an output image to be valid, it must a) not be null and b) must equal the width, height and type passed. If these requirements are not met, a new, valid BufferedImage is returned.

Additional methods are provided to check against an existing image (most likely the input to the filter), or an existing image and a new data type.

Parameters:
output - the current output
width - the desired width.
height - the desired height.
type - the desired type.
Returns:
a valid output image.