Imp
[using it]
Interface Manipulation Package v4.0 (2008-06-25) a-projector ©copyright Author


imp.ima.util
Class RgbDiffusionFilter

java.lang.Object
  extended by imp.ima.util.RgbFilter
      extended by imp.ima.util.RgbDiffusionFilter
Direct Known Subclasses:
AnisotropicDiffusion, IsotropicDiffusion, WinnerTakeAll

public class RgbDiffusionFilter
extends RgbFilter

Encapsulates a RGB color image diffusion filter.


Constructor Summary
RgbDiffusionFilter(boolean channel, int borderSize, int borderValue)
          Creates a RgbDiffusionFilter.
 
Method Summary
static int[] double2int(double[] src, int[] dst)
          Converts doubles to integers between [0-255].
 double getChannel(int ij, int width, int[] src0, double[] src)
          Defines the filter iterative operation at the red-green-blue pixel neighborhood level.
 int getRGB(int ij, int width, int[] red0, int[] green0, int[] blue0, int[] red, int[] green, int[] blue)
          Defines the filter iterative operation at the RGB pixel neighborhood level.
static double[] int2double(int[] src, double[] dst)
          Converts integers to doubles.
 boolean more(int iteration, double[] dst, int width, int height)
          Returns true if the channel diffusion process should carry on, false it it has converged
Diffusion filters overwrite this method.
 boolean more(int iteration, int[] rgb, int width, int height)
          Returns true if the RGB diffusion process should carry on, false it it has converged
Diffusion filters overwrite this method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RgbDiffusionFilter

public RgbDiffusionFilter(boolean channel,
                          int borderSize,
                          int borderValue)
Creates a RgbDiffusionFilter.

Parameters:
channel - [optional, default is false] If true filter each red-green-blue channel, else filter the RGB pixel.
borderSize - [optional, default is 0] Border size: width/height in pixel on the image border where the filter must not be computed.
borderValue - [optional, default is 0] Border RGB value: value to be set on border where the filter is not computed.
Method Detail

double2int

public static int[] double2int(double[] src,
                               int[] dst)
Converts doubles to integers between [0-255].

Parameters:
src - Source buffer.
dst - [optional, default is null] Optional destination buffer, if null or omitted the destination buffer is created.
Returns:
The destination buffer.

getChannel

public double getChannel(int ij,
                         int width,
                         int[] src0,
                         double[] src)
Defines the filter iterative operation at the red-green-blue pixel neighborhood level.
Filters with a border defined on each red-green-blue value overwrite this method.

Parameters:
ij - Buffer index with pixels[i,j] = pixels[ij = i + j * width]
width - Buffer width.
src0 - Initial red/green/blue channel buffer.
src - Current (at iteration n) red/green/blue channel buffer.

getRGB

public int getRGB(int ij,
                  int width,
                  int[] red0,
                  int[] green0,
                  int[] blue0,
                  int[] red,
                  int[] green,
                  int[] blue)
Defines the filter iterative operation at the RGB pixel neighborhood level.
Filters with a border defined on each RGB pixel overwrite this method.

Parameters:
ij - Buffer index with pixels[i,j] = pixels[ij = i + j * width]
width - Buffer width.
red0 - Initial red channel buffer.
green0 - Initial green channel buffer.
blue0 - Initial blue channel buffer.
red - Current (at iteration n) red channel buffer.
green - Current (at iteration n) green channel buffer.
blue - Current (at iteration n) blue channel buffer.

int2double

public static double[] int2double(int[] src,
                                  double[] dst)
Converts integers to doubles.

Parameters:
src - Source buffer.
dst - [optional, default is null] Optional destination buffer, if null or omitted the destination buffer is created.
Returns:
The destination buffer.

more

public boolean more(int iteration,
                    double[] dst,
                    int width,
                    int height)
Returns true if the channel diffusion process should carry on, false it it has converged
Diffusion filters overwrite this method.

Parameters:
iteration - Iteration number;
dst - Last iteration result.
width - Buffer width.
height - Buffer height.

more

public boolean more(int iteration,
                    int[] rgb,
                    int width,
                    int height)
Returns true if the RGB diffusion process should carry on, false it it has converged
Diffusion filters overwrite this method.

Parameters:
iteration - Iteration number;
rgb - Last iteration result.
width - Buffer width.
height - Buffer height.