jjil.algorithm
Class RgbClip

java.lang.Object
  extended by jjil.core.PipelineStage
      extended by jjil.algorithm.RgbClip

public class RgbClip
extends PipelineStage

Pipeline stage performs color clipping, setting all pixels that do not meet the threshold test to 0, otherwise leaving them alone.

The test is abs(pixel.R - red) + abs(pixel.G - green) + abs(pixel.B - blue) < limit.

The test direction can be reversed using the dir parameter.

Author:
webb

Constructor Summary
RgbClip(byte r, byte g, byte b, int l, boolean dir)
          Creates a new instance of RgbClip.
 
Method Summary
 void push(Image image)
          Clips the RGB image and sets all pixels that fail/pass the test (according to bDir) to 0.
 void setParameters(byte r, byte g, byte b, int l, boolean dir)
          Change the threshold parameters.
 java.lang.String toString()
          Return a string describing the clipping operation.
 
Methods inherited from class jjil.core.PipelineStage
getFront, isEmpty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RgbClip

public RgbClip(byte r,
               byte g,
               byte b,
               int l,
               boolean dir)
Creates a new instance of RgbClip. The clip test is defined here.

Parameters:
r - red value
g - green value
b - value
l - the threshold
dir - if true pixels that fail test are set to 0; if false pixels that pass test are set to 0.
Method Detail

push

public void push(Image image)
          throws Error
Clips the RGB image and sets all pixels that fail/pass the test (according to bDir) to 0.

Specified by:
push in class PipelineStage
Parameters:
image - the input image.
Throws:
Error - if the cropping window extends outside the input image, or the input image is not an RgbImage.

setParameters

public void setParameters(byte r,
                          byte g,
                          byte b,
                          int l,
                          boolean dir)
Change the threshold parameters.

Parameters:
r - red value
g - green value
b - value
l - the threshold
dir - if true pixels that fail test are set to 0; if false pixels that pass test are set to 0.

toString

public java.lang.String toString()
Return a string describing the clipping operation.

Overrides:
toString in class java.lang.Object
Returns:
the string describing the clipping operation.