jjil.algorithm
Class RgbSubSample

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

public class RgbSubSample
extends PipelineStage

Pipeline stage reduces an RgbImage's size by subsampling WITHOUT smoothing. This results in an aliased image but can be done very quickly and the artifacts resulting from the subsampling can themselves be useful for detection of certain kinds of objects such as barcodes. This pipeline stage should be used with caution because of the artifacts introduced by subsampling without smoothing.

Author:
webb

Constructor Summary
RgbSubSample(int cTargetWidth, int cTargetHeight)
          Creates a new instance of RgbSubSample.
 
Method Summary
 int getTargetHeight()
          Returns the target height.
 int getTargetWidth()
          Returns the target width.
 void push(Image image)
          Reduces an RgbImage by a factor horizontally and vertically through averaging.
 void setTargetSize(int cTargetWidth, int cTargetHeight)
          Sets a new width, height target size.
 java.lang.String toString()
          Return a string describing the reduction 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

RgbSubSample

public RgbSubSample(int cTargetWidth,
                    int cTargetHeight)
             throws Error
Creates a new instance of RgbSubSample.

Parameters:
cTargetWidth - the new width
cTargetHeight - the new height
Throws:
Error - if the target width or height is less than or equal to zero.
Method Detail

push

public void push(Image image)
          throws Error
Reduces an RgbImage by a factor horizontally and vertically through averaging. The reduction factor must be an even multiple of the image size.

Specified by:
push in class PipelineStage
Parameters:
image - the input image.
Throws:
Error - if the input image is not gray, or the reduction factor does not evenly divide the image size.

getTargetHeight

public int getTargetHeight()
Returns the target height.

Returns:
the target height.

getTargetWidth

public int getTargetWidth()
Returns the target width.

Returns:
the target width.

setTargetSize

public void setTargetSize(int cTargetWidth,
                          int cTargetHeight)
                   throws Error
Sets a new width, height target size.

Parameters:
cTargetWidth - the target image width.
cTargetHeight - the target image height.
Throws:
Error - if either cTargetWidth or cTargetHeight is less than or equal to 0.

toString

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

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