org.jscience.media.pictures.filters
Class Kernel

java.lang.Object
  extended by org.jscience.media.pictures.filters.Kernel

public class Kernel
extends java.lang.Object

A convolution kernel.


Field Summary
 int cols
          DOCUMENT ME!
static float[] EDGE_LAPLACE1
          DOCUMENT ME!
static float[] EDGE_LAPLACE2
          DOCUMENT ME!
static float[] FREI_CHEN_H
          DOCUMENT ME!
static float[] FREI_CHEN_V
          DOCUMENT ME!
 float[] matrix
          DOCUMENT ME!
static float[] PREWITT_H
          DOCUMENT ME!
static float[] PREWITT_V
          DOCUMENT ME!
static float R2
          DOCUMENT ME!
static float[] ROBERTS_H
          DOCUMENT ME!
static float[] ROBERTS_V
          DOCUMENT ME!
 int rows
          DOCUMENT ME!
static float[] SOBEL_H
          DOCUMENT ME!
static float[] SOBEL_V
          DOCUMENT ME!
 int xCentre
          DOCUMENT ME!
 int yCentre
          DOCUMENT ME!
 
Constructor Summary
Kernel()
          Construct a null kernel.
Kernel(float[] matrix)
          Construct a kernel with the given 3x3 matrix.
Kernel(int rows, int cols, float[] matrix)
          Construct a kernel with the given matrix.
Kernel(int rows, int cols, int xCentre, int yCentre, float[] matrix)
          Construct a kernel with the given matrix.
 
Method Summary
 float[] getMatrix()
          DOCUMENT ME!
 void normalize()
          Normalize a convolution kernel.
 void setMatrix(float[] matrix)
          Set the (3x3) convolution kernel.
 void setMatrix(int rows, int cols, float[] matrix)
          Set the convolution kernel.
 void setMatrix(int rows, int cols, int xCentre, int yCentre, float[] matrix)
          Set the convolution kernel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

R2

public static final float R2
DOCUMENT ME!


ROBERTS_V

public static final float[] ROBERTS_V
DOCUMENT ME!


ROBERTS_H

public static final float[] ROBERTS_H
DOCUMENT ME!


PREWITT_V

public static final float[] PREWITT_V
DOCUMENT ME!


PREWITT_H

public static final float[] PREWITT_H
DOCUMENT ME!


SOBEL_V

public static final float[] SOBEL_V
DOCUMENT ME!


SOBEL_H

public static float[] SOBEL_H
DOCUMENT ME!


FREI_CHEN_V

public static final float[] FREI_CHEN_V
DOCUMENT ME!


FREI_CHEN_H

public static float[] FREI_CHEN_H
DOCUMENT ME!


EDGE_LAPLACE1

public static float[] EDGE_LAPLACE1
DOCUMENT ME!


EDGE_LAPLACE2

public static float[] EDGE_LAPLACE2
DOCUMENT ME!


matrix

public float[] matrix
DOCUMENT ME!


rows

public int rows
DOCUMENT ME!


cols

public int cols
DOCUMENT ME!


xCentre

public int xCentre
DOCUMENT ME!


yCentre

public int yCentre
DOCUMENT ME!

Constructor Detail

Kernel

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


Kernel

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

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

Kernel

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

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

Kernel

public Kernel(int rows,
              int cols,
              int xCentre,
              int yCentre,
              float[] matrix)
Construct a kernel with the given matrix.

Parameters:
rows - the number of rows in the kernel
cols - the number of columns in the kernel
xCentre - the centre of the kernel in the x direction
yCentre - the centre of the kernel in the y direction
matrix - an array of rowscols floats containing the kernel
Method Detail

setMatrix

public void setMatrix(float[] matrix)
Set the (3x3) convolution kernel.

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

setMatrix

public void setMatrix(int rows,
                      int cols,
                      float[] matrix)
Set the convolution 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

setMatrix

public void setMatrix(int rows,
                      int cols,
                      int xCentre,
                      int yCentre,
                      float[] matrix)
Set the convolution kernel.

Parameters:
rows - the number of rows in the kernel
cols - the number of columns in the kernel
xCentre - the centre of the kernel in the x direction
yCentre - the centre of the kernel in the y direction
matrix - an array of rowscols floats containing the kernel

getMatrix

public float[] getMatrix()
DOCUMENT ME!

Returns:
DOCUMENT ME!

normalize

public void normalize()
Normalize a convolution kernel. You can call this to normalize a kernel you've created by hand.