jjil.algorithm
Class RgbCrop

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

public class RgbCrop
extends PipelineStage

Pipeline stage crops a gray image to a given rectangular cropping window.

Author:
webb

Constructor Summary
RgbCrop(int x, int y, int width, int height)
          Creates a new instance of RgbCrop.
 
Method Summary
 int getHeight()
          Gets the cropping window height
 int getLeft()
          Gets the cropping window left edge
 int getTop()
          Gets the cropping window top
 int getWidth()
          Gets the cropping window width
 void push(Image image)
          Crops the input RGB image to the cropping window that was specified in the constructor.
 void setWindow(int x, int y, int width, int height)
          Change the cropping window.
 java.lang.String toString()
          Return a string describing the cropping 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

RgbCrop

public RgbCrop(int x,
               int y,
               int width,
               int height)
        throws Error
Creates a new instance of RgbCrop. The cropping window is specified here.

Parameters:
x - left edge of cropping window
y - top edge of cropping window
width - width of cropping window
height - height of cropping window
Throws:
Error - if the top left corner of the window is negative, or the window area is non-positive.
Method Detail

push

public void push(Image image)
          throws Error
Crops the input RGB image to the cropping window that was specified in the constructor.

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.

getHeight

public int getHeight()
Gets the cropping window height

Returns:
the cropping window height

getLeft

public int getLeft()
Gets the cropping window left edge

Returns:
the cropping window left edge

getTop

public int getTop()
Gets the cropping window top

Returns:
the cropping window top

getWidth

public int getWidth()
Gets the cropping window width

Returns:
the cropping window width

setWindow

public void setWindow(int x,
                      int y,
                      int width,
                      int height)
               throws Error
Change the cropping window.

Parameters:
x - left edge of cropping window
y - top edge of cropping window
width - width of cropping window
height - height of cropping window
Throws:
Error - if the top left corner of the window is negative, or the window area is non-positive.

toString

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

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