jjil.algorithm
Class MaskedGray8SubImgGen

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

public class MaskedGray8SubImgGen
extends PipelineStage

Generates subimages from a source Gray8Image, using a mask. In a normal subimage generator subimages are generated evenly spaced across the input image. Here, the subimage is generated only if is center point is not masked. This can increase processing speed in hierarchical detection operations since features detected at coarser resolution don't have to be redetected at finer resolution.

Author:
webb

Constructor Summary
MaskedGray8SubImgGen(int nWidth, int nHeight, int nXOffset, int nYOffset)
          Creates a new instance of MaskedGray8SubImgGen.
 
Method Summary
 Image getFront()
          Returns the next subimage generated.
 boolean isEmpty()
          Returns true iff there is another image available from getFront().
 void push(Image image)
          Accepts a new MaskedGray8Image and initializes all the generator indices.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaskedGray8SubImgGen

public MaskedGray8SubImgGen(int nWidth,
                            int nHeight,
                            int nXOffset,
                            int nYOffset)
Creates a new instance of MaskedGray8SubImgGen.

Parameters:
nWidth - the width of the generated subimage.
nHeight - the height of the generated subimage.
nXOffset - the horizontal offset between subimages.
nYOffset - the vertical offset between subimages.
Method Detail

isEmpty

public boolean isEmpty()
Returns true iff there is another image available from getFront(). Note that the existence of another image from MaskedGray8SubImgGen depends on the mask image so there's no way to guarantee there will be even one subimage generated for a particular input. You must always call isEmpty().

Overrides:
isEmpty in class PipelineStage
Returns:
true iff there is another image available from getFront().

getFront

public Image getFront()
               throws Error
Returns the next subimage generated. The subimage will have its offset set to indicate where it was generated in the input image.

Overrides:
getFront in class PipelineStage
Returns:
a MaskedGray8SubImage that is the next subimage in the input Gray8Image to be processed.
Throws:
Error - if no subimage is available (you have to call isEmpty() to determine if a subimage is available. As few as 0 subimage can be generated for a given input if the entire image is masked.) Also throws if the output image (stored in the superclass) has been changed in type.

push

public void push(Image image)
          throws Error
Accepts a new MaskedGray8Image and initializes all the generator indices.

Specified by:
push in class PipelineStage
Parameters:
image - The input MaskedGray8Image.
Throws:
Error - if the input is not of type MaskedGray8Image or is smaller than the subimages to be generated.