Class ImageProcessor

java.lang.Object
  |
  +--ImageProcessor

public class ImageProcessor
extends java.lang.Object


Constructor Summary
ImageProcessor()
           
 
Method Summary
 java.awt.Image getFrame(javax.media.Player player)
          Returns the current frame in the live video stream specified by Player.
 int[] getPixel(java.awt.Image img, int x, int y, int w, int h)
          Allows acess to the pixels inside a Java.awt.Image.
 javax.media.Player initPlayer(javax.media.format.VideoFormat vFormat)
          Finds a video capture device that supports the specified VideoFormat.
static void saveJPG(java.awt.Image img, java.lang.String s)
          Saves the image to disk in JPEG format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageProcessor

public ImageProcessor()
Method Detail

getFrame

public java.awt.Image getFrame(javax.media.Player player)
Returns the current frame in the live video stream specified by Player. This method is meant for players in the started state.

Parameters:
player - Player object currently playing the live video stream.
Returns:
Image Image object representing the current frame.

getPixel

public int[] getPixel(java.awt.Image img,
                      int x,
                      int y,
                      int w,
                      int h)
               throws java.lang.InterruptedException
Allows acess to the pixels inside a Java.awt.Image. Returns an int array with values in each pixel within the rectangle specified by the parameters x, y, w and h. (x,y) represents the coordinates of the upper left hand corner of the rectangle, while (w,h) represents the width and height of the rectangle. Throws InterruptedException if the pixel grab process is interrupted.

Parameters:
img - the image to be processed. x the x coordinate of the upper left hand corner. y the y coordinate of the upper left hand corner. w the width of the rectangle h the height of the rectangle.
Returns:
int[] the integer array representing the value of each pixel in the rectangle.
Throws:
java.lang.InterruptedException - thrown if the method is interrupted.

initPlayer

public javax.media.Player initPlayer(javax.media.format.VideoFormat vFormat)
Finds a video capture device that supports the specified VideoFormat. Starts streaming the live video and returns the player. Returns null if a video source with the specified format could not be found or started.

Parameters:
vFormat - the desired format of the live video stream
Returns:
Player the player representing the video stream

saveJPG

public static void saveJPG(java.awt.Image img,
                           java.lang.String s)
Saves the image to disk in JPEG format.

Parameters:
img - the image to save to disk s the name of the file to save to
Returns:
void