jjil.algorithm
Class RgbAvg2Gray

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

public class RgbAvg2Gray
extends PipelineStage

Pipeline stage converts an ARGB color image into a Gray8Image. It does this by averaging the R, G, and B values. Note that since the byte image is signed, each unsigned byte in the ARGB word is converted to a signed integer before doing the average. So the word 0x00FF8001 would get R, G, and B values 127, 0, and -126 (and the average would be 0).

Author:
webb

Constructor Summary
RgbAvg2Gray()
          Creates a new instance of RgbAvg2Gray
 
Method Summary
 void push(Image image)
          Implementation of push operation from PipelineStage.
 
Methods inherited from class jjil.core.PipelineStage
getFront, isEmpty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RgbAvg2Gray

public RgbAvg2Gray()
Creates a new instance of RgbAvg2Gray

Method Detail

push

public void push(Image image)
          throws Error
Implementation of push operation from PipelineStage. Averages the R, G, and B values to create a gray image of the same size. Note that the RGB->Gray conversion involves changing the data range of each pixel from 0->255 to -128->127 because byte is a signed type.

Specified by:
push in class PipelineStage
Parameters:
image - the input image
Throws:
Error - if image is not an RgbImage