jjil.algorithm
Class GrayReduce

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

public class GrayReduce
extends PipelineStage

Pipeline stage reduces an image's size by rectangular averaging. The reduction factor must evenly divide the image size. No smoothing is done.

Author:
webb

Constructor Summary
GrayReduce(int cReduceWidth, int cReduceHeight)
          Creates a new instance of GrayReduce.
 
Method Summary
 int getHeightReduction()
          Returns the height reduction factor.
 int getWidthReduction()
          Returns the width reduction factor.
 void push(Image image)
          Reduces a gray image by a factor horizontally and vertically through averaging.
 void setReductionFactor(int cReduceWidth, int cReduceHeight)
          Sets a new width, height reduction factor.
 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

GrayReduce

public GrayReduce(int cReduceWidth,
                  int cReduceHeight)
           throws Error
Creates a new instance of GrayReduce.

Parameters:
cReduceWidth - amount to reduce the width by
cReduceHeight - amount to reduce the height by
Throws:
Error - if the reduce width or height is less than or equal to zero.
Method Detail

push

public void push(Image image)
          throws Error
Reduces a gray image 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.

getHeightReduction

public int getHeightReduction()
Returns the height reduction factor.

Returns:
the height reduction factor.

getWidthReduction

public int getWidthReduction()
Returns the width reduction factor.

Returns:
the width reduction factor.

setReductionFactor

public void setReductionFactor(int cReduceWidth,
                               int cReduceHeight)
                        throws Error
Sets a new width, height reduction factor.

Parameters:
cReduceWidth - the amount by which to reduce the image width.
cReduceHeight - the amount by which to reduce the image height.
Throws:
Error - if either cReduceWidth or cReduceHeight 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.