org.jscience.computing.ai.vision
Class NoiseFilter

java.lang.Object
  extended by org.jscience.computing.ai.vision.Filter
      extended by org.jscience.computing.ai.vision.NoiseFilter

public class NoiseFilter
extends Filter

Implements simple black-and-white (impulse/salt and pepper) noise and Gaussian noise.


Field Summary
static int GAUSSIAN
          Create Gaussian noise.
static int IMPULSE
          Create impulse noise.
protected  double impulseRatio
          The frequency of the impulse noise.
protected  int noiseType
          The noise type.
protected  double stdDev
          The standard deviation used for gaussian noise (default = 10).
 
Constructor Summary
NoiseFilter()
          Creates a new instance of NoiseFilter
NoiseFilter(int noiseType)
          Create a new instance of NoiseFilter, specifying the noise type.
NoiseFilter(int noiseType, double parameter)
          Create a new instance of NoiseFilter, specifying the noise type and parameters.
 
Method Summary
 java.awt.image.BufferedImage filter(java.awt.image.BufferedImage image, java.awt.image.BufferedImage output)
          Apply noise to the input image.
protected  java.awt.image.BufferedImage gaussianNoise(java.awt.image.BufferedImage image, java.awt.image.BufferedImage output)
          Add gaussian noise to the input image.
 double getGaussianStdDev()
          Get the gaussian standard deviation.
 double getImpulseRatio()
          Get the impulse frequency.
 int getNoiseType()
          Get the noise type.
protected  java.awt.image.BufferedImage impulseNoise(java.awt.image.BufferedImage image, java.awt.image.BufferedImage output)
          Add impulse noise to the image.
static void main(java.lang.String[] args)
          Simple test function.
 void setGaussianStdDev(double stdDev)
          Set the gaussian standard deviation.
 void setImpulseRatio(double impulseRatio)
          Set the impulse frequency.
 void setNoiseType(int noiseType)
          Set the noise type.
 
Methods inherited from class org.jscience.computing.ai.vision.Filter
filter, verifyOutput, verifyOutput, verifyOutput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMPULSE

public static final int IMPULSE
Create impulse noise.

See Also:
Constant Field Values

GAUSSIAN

public static final int GAUSSIAN
Create Gaussian noise.

See Also:
Constant Field Values

noiseType

protected int noiseType
The noise type.


stdDev

protected double stdDev
The standard deviation used for gaussian noise (default = 10).


impulseRatio

protected double impulseRatio
The frequency of the impulse noise.

Constructor Detail

NoiseFilter

public NoiseFilter()
Creates a new instance of NoiseFilter


NoiseFilter

public NoiseFilter(int noiseType)
Create a new instance of NoiseFilter, specifying the noise type.

Parameters:
noiseType - the noise type.

NoiseFilter

public NoiseFilter(int noiseType,
                   double parameter)
Create a new instance of NoiseFilter, specifying the noise type and parameters.

Parameters:
noiseType - the noise type.
parameter - if impule noise, the frequency. If gaussian noise, the standard deviation.
Method Detail

setNoiseType

public void setNoiseType(int noiseType)
Set the noise type.

Parameters:
noiseType - the new noise type.

getNoiseType

public int getNoiseType()
Get the noise type.

Returns:
the current noise type.

setGaussianStdDev

public void setGaussianStdDev(double stdDev)
Set the gaussian standard deviation.

Parameters:
stdDev - the new standard deviation.

getGaussianStdDev

public double getGaussianStdDev()
Get the gaussian standard deviation.

Returns:
the current standard deviation.

setImpulseRatio

public void setImpulseRatio(double impulseRatio)
Set the impulse frequency.

Parameters:
impulseRatio - the new impulse frequency.

getImpulseRatio

public double getImpulseRatio()
Get the impulse frequency.

Returns:
the current impulse frequency.

main

public static void main(java.lang.String[] args)
Simple test function.

Parameters:
args - the command line arguments

filter

public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage image,
                                           java.awt.image.BufferedImage output)
Apply noise to the input image.

Specified by:
filter in class Filter
Parameters:
image - the input image.
output - the output image (optional).
Returns:
the filtered, noisy image.
See Also:
Filter.verifyOutput(BufferedImage,BufferedImage)

impulseNoise

protected java.awt.image.BufferedImage impulseNoise(java.awt.image.BufferedImage image,
                                                    java.awt.image.BufferedImage output)
Add impulse noise to the image.

Parameters:
image - the input image.
output - the output image.
Returns:
the noisy image.

gaussianNoise

protected java.awt.image.BufferedImage gaussianNoise(java.awt.image.BufferedImage image,
                                                     java.awt.image.BufferedImage output)
Add gaussian noise to the input image.

Parameters:
image - the input image.
output - the output image.
Returns:
the noisy image.