org.jscience.media.pictures.filters
Class ConvolveFilter

java.lang.Object
  extended by java.awt.image.ImageFilter
      extended by org.jscience.media.pictures.filters.WholeImageFilter
          extended by org.jscience.media.pictures.filters.ConvolveFilter
All Implemented Interfaces:
java.awt.image.ImageConsumer, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AverageFilter, BlurFilter, BumpFilter, GaussianFilter, SharpenFilter

public class ConvolveFilter
extends WholeImageFilter

A filter which applies a convolution kernel to an image.

See Also:
Serialized Form

Field Summary
 boolean alpha
          DOCUMENT ME!
protected  Kernel kernel
          DOCUMENT ME!
 
Fields inherited from class org.jscience.media.pictures.filters.WholeImageFilter
canFilterIndexColorModel, defaultRGBModel, inBytePixels, inPixels, originalSpace, transformedSpace
 
Fields inherited from class java.awt.image.ImageFilter
consumer
 
Fields inherited from interface java.awt.image.ImageConsumer
COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT
 
Constructor Summary
ConvolveFilter()
          Construct a filter with a null kernel.
ConvolveFilter(float[] matrix)
          Construct a filter with the given 3x3 kernel.
ConvolveFilter(int rows, int cols, float[] matrix)
          Construct a filter with the given kernel.
ConvolveFilter(Kernel kernel)
          Construct a filter with the given 3x3 kernel.
 
Method Summary
static void convolve(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height)
          DOCUMENT ME!
static void convolve(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha)
          DOCUMENT ME!
static void convolveH(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha)
          Convolve with a kernel consisting of one row
static void convolveHV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha)
          Convolve with a 2D kernel
static void convolveV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha)
          Convolve with a kernel consisting of one column
 Kernel getKernel()
          DOCUMENT ME!
 void imageComplete(int status)
          DOCUMENT ME!
 void setKernel(Kernel kernel)
          DOCUMENT ME!
 java.lang.String toString()
          DOCUMENT ME!
 
Methods inherited from class org.jscience.media.pictures.filters.WholeImageFilter
setColorModel, setDimensions, setPixels, setPixels, transformSpace
 
Methods inherited from class java.awt.image.ImageFilter
clone, getFilterInstance, resendTopDownLeftRight, setHints, setProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kernel

protected Kernel kernel
DOCUMENT ME!


alpha

public boolean alpha
DOCUMENT ME!

Constructor Detail

ConvolveFilter

public ConvolveFilter()
Construct a filter with a null kernel. This is only useful if you're going to change the kernel later on.


ConvolveFilter

public ConvolveFilter(float[] matrix)
Construct a filter with the given 3x3 kernel.

Parameters:
matrix - an array of 9 floats containing the kernel

ConvolveFilter

public ConvolveFilter(int rows,
                      int cols,
                      float[] matrix)
Construct a filter with the given kernel.

Parameters:
rows - the number of rows in the kernel
cols - the number of columns in the kernel
matrix - an array of rowscols floats containing the kernel

ConvolveFilter

public ConvolveFilter(Kernel kernel)
Construct a filter with the given 3x3 kernel.

Parameters:
kernel - an array of 9 floats containing the kernel
Method Detail

setKernel

public void setKernel(Kernel kernel)
DOCUMENT ME!

Parameters:
kernel - DOCUMENT ME!

getKernel

public Kernel getKernel()
DOCUMENT ME!

Returns:
DOCUMENT ME!

imageComplete

public void imageComplete(int status)
DOCUMENT ME!

Specified by:
imageComplete in interface java.awt.image.ImageConsumer
Overrides:
imageComplete in class java.awt.image.ImageFilter
Parameters:
status - DOCUMENT ME!

convolve

public static void convolve(Kernel kernel,
                            int[] inPixels,
                            int[] outPixels,
                            int width,
                            int height)
DOCUMENT ME!

Parameters:
kernel - DOCUMENT ME!
inPixels - DOCUMENT ME!
outPixels - DOCUMENT ME!
width - DOCUMENT ME!
height - DOCUMENT ME!

convolve

public static void convolve(Kernel kernel,
                            int[] inPixels,
                            int[] outPixels,
                            int width,
                            int height,
                            boolean alpha)
DOCUMENT ME!

Parameters:
kernel - DOCUMENT ME!
inPixels - DOCUMENT ME!
outPixels - DOCUMENT ME!
width - DOCUMENT ME!
height - DOCUMENT ME!
alpha - DOCUMENT ME!

convolveHV

public static void convolveHV(Kernel kernel,
                              int[] inPixels,
                              int[] outPixels,
                              int width,
                              int height,
                              boolean alpha)
Convolve with a 2D kernel

Parameters:
kernel - DOCUMENT ME!
inPixels - DOCUMENT ME!
outPixels - DOCUMENT ME!
width - DOCUMENT ME!
height - DOCUMENT ME!
alpha - DOCUMENT ME!

convolveH

public static void convolveH(Kernel kernel,
                             int[] inPixels,
                             int[] outPixels,
                             int width,
                             int height,
                             boolean alpha)
Convolve with a kernel consisting of one row

Parameters:
kernel - DOCUMENT ME!
inPixels - DOCUMENT ME!
outPixels - DOCUMENT ME!
width - DOCUMENT ME!
height - DOCUMENT ME!
alpha - DOCUMENT ME!

convolveV

public static void convolveV(Kernel kernel,
                             int[] inPixels,
                             int[] outPixels,
                             int width,
                             int height,
                             boolean alpha)
Convolve with a kernel consisting of one column

Parameters:
kernel - DOCUMENT ME!
inPixels - DOCUMENT ME!
outPixels - DOCUMENT ME!
width - DOCUMENT ME!
height - DOCUMENT ME!
alpha - DOCUMENT ME!

toString

public java.lang.String toString()
DOCUMENT ME!

Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!