com.pearsoneduc.ip.op
Class StandardKernel

java.lang.Object
  |
  +--java.awt.image.Kernel
        |
        +--com.pearsoneduc.ip.op.StandardKernel
Direct Known Subclasses:
GaussianKernel, HighBoostKernel, HighPassKernel, HorizontalPrewittKernel, HorizontalSobelKernel, IdentityKernel, LaplacianKernel, MeanKernel, SeparableGaussianKernel, VerticalPrewittKernel, VerticalSobelKernel

public class StandardKernel
extends java.awt.image.Kernel

Extends the Kernel class, adding I/O capabilities and a toString() method.

Version:
1.1 [1999/07/29]
Author:
Nick Efford

Constructor Summary
StandardKernel(int w, int h, float[] data)
          Constructs a StandardKernel with the specified dimensions and coefficients.
StandardKernel(int w, int h, float[] data, int n)
          Constructs a StandardKernel with the specified dimensions, coefficients and coefficient formatting.
 
Method Summary
static StandardKernel createKernel(java.io.Reader reader)
          Creates a StandardKernel by reading data.
static StandardKernel createKernel(java.io.Reader reader, boolean normalise)
          Creates a StandardKernel by reading data.
 int getFractionDigits()
           
 void setFractionDigits(int n)
          Sets number of digits used to format fractional part of a coefficient.
 java.lang.String toString()
           
 void write(java.io.Writer writer)
          Writes kernel data.
 
Methods inherited from class java.awt.image.Kernel
clone, getHeight, getKernelData, getWidth, getXOrigin, getYOrigin
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardKernel

public StandardKernel(int w,
                      int h,
                      float[] data)
Constructs a StandardKernel with the specified dimensions and coefficients.
Parameters:
w - width of kernel
h - height of kernel
data - array of coefficients, in row-major order

StandardKernel

public StandardKernel(int w,
                      int h,
                      float[] data,
                      int n)
Constructs a StandardKernel with the specified dimensions, coefficients and coefficient formatting.
Parameters:
w - width of kernel
h - height of kernel
data - array of coefficients, in row-major order
n - number of fraction digits used when writing coefficients
Method Detail

createKernel

public static StandardKernel createKernel(java.io.Reader reader)
                                   throws java.io.IOException
Creates a StandardKernel by reading data.
Parameters:
reader - source of kernel data
Returns:
the kernel.

createKernel

public static StandardKernel createKernel(java.io.Reader reader,
                                          boolean normalise)
                                   throws java.io.IOException
Creates a StandardKernel by reading data.
Parameters:
reader - source of kernel data
normalise - flag to indicate whether coefficients should be normalised on input
Returns:
the kernel.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setFractionDigits

public void setFractionDigits(int n)
Sets number of digits used to format fractional part of a coefficient.

getFractionDigits

public int getFractionDigits()
Returns:
number of digits used format fractional part of a coefficient.

write

public void write(java.io.Writer writer)
Writes kernel data.
Parameters:
writer - destination for kernel data