javaclient
Class BlobfinderInterface

java.lang.Object
  extended by javaclient.PlayerDevice
      extended by javaclient.BlobfinderInterface

public class BlobfinderInterface
extends PlayerDevice

The blobfinder interface provides access to devices that detect blobs in images.

Version:
Author:
Maxim A. Batalin & Radu Bogdan Rusu

Field Summary
 short PLAYER_BLOBFINDER_MAX_BLOBS
          the maximum number of blobs in total
 
Fields inherited from class javaclient.PlayerDevice
device, DIFFERENCE_SYNCH_FACTOR, index, is, os, pc, PLAYER_MAX_REQREP_SIZE, PLAYER_STXX, reserved, size, t_sec, t_usec, ts_sec, ts_usec
 
Constructor Summary
BlobfinderInterface(PlayerClient pc, short indexOfDevice)
          Constructor for BlobfinderInterface.
 
Method Summary
 Blob getBlob(int i)
          Get a specified blob.
 short getBlobCount()
          Get the number of valid blobs.
 Blob[] getBlobs()
          Get all the blobs.
 short getImageHeight()
          Get image height in pixels.
 short getImageWidth()
          Get image width in pixels.
 void handleResponse(int size)
          Handle acknowledgement response messages (threaded mode).
 void readData()
          Read the list of detected blobs.
 void setImagerParams(int brightness, int contrast, int colormode, int autogain)
          Configuration request: Set imager params.
 void setTrackingColor(int rmin, int rmax, int gmin, int gmax, int bmin, int bmax)
          Configuration request: Set tracking color.
 
Methods inherited from class javaclient.PlayerDevice
getTimeForDataSampled_sec, getTimeForDataSampled_usec, getTimeForDataSampled, getTimeForDataSent_sec, getTimeForDataSent_usec, getTimeForDataSent, handleEARMessage, handleNARMessage, readHeader, sendHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLAYER_BLOBFINDER_MAX_BLOBS

public final short PLAYER_BLOBFINDER_MAX_BLOBS
the maximum number of blobs in total

See Also:
Constant Field Values
Constructor Detail

BlobfinderInterface

public BlobfinderInterface(PlayerClient pc,
                           short indexOfDevice)
Constructor for BlobfinderInterface.

Parameters:
pc - a reference to the PlayerClient object
indexOfDevice - the index of the device
Method Detail

readData

public void readData()
Read the list of detected blobs.

Overrides:
readData in class PlayerDevice

setTrackingColor

public void setTrackingColor(int rmin,
                             int rmax,
                             int gmin,
                             int gmax,
                             int bmin,
                             int bmax)
Configuration request: Set tracking color.

For some sensors (ie CMUcam), simple blob tracking tracks only one color. To set the tracking color, send a request with the format below, including the RGB color ranges (max and min). Values of -1 will cause the track color to be automatically set to the current window color. This is useful for setting the track color by holding the tracking object in front of the lens.

Parameters:
rmin - Red minimum value (0-255)
rmax - Red maximum value (0-255)
gmin - Green minimum value (0-255)
gmax - Green maximum value (0-255)
bmin - Blue minimum value (0-255)
bmax - Blue maximum value (0-255)

setImagerParams

public void setImagerParams(int brightness,
                            int contrast,
                            int colormode,
                            int autogain)
Configuration request: Set imager params.

Imaging sensors that do blob tracking generally have some sorts of image quality parameters that you can tweak. The following ones are implemented here:

Parameters:
brightness - brightness value (0-255)
contrast - contrast value (0-255)
colormode - color mode (0=RGB/AWB off, 1=RGB/AWB on, 2=YCrCB/AWB off, 3=YCrCb/AWB on)
autogain - auto gain (0=off, 1=on)

getImageWidth

public short getImageWidth()
Get image width in pixels.

Returns:
image width in pixels as a short

getImageHeight

public short getImageHeight()
Get image height in pixels.

Returns:
image height in pixels as a short

getBlobCount

public short getBlobCount()
Get the number of valid blobs.

Returns:
number of valid blobs as a short

getBlobs

public Blob[] getBlobs()
Get all the blobs.

Returns:
an array of Blob objects filled with data

getBlob

public Blob getBlob(int i)
Get a specified blob.

Parameters:
i - the number of blob from the blob array
Returns:
the specified Blob object

handleResponse

public void handleResponse(int size)
Handle acknowledgement response messages (threaded mode).

Overrides:
handleResponse in class PlayerDevice
Parameters:
size - size of the payload