javaclient
Class CameraInterface

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

public class CameraInterface
extends PlayerDevice

The camera interface is used to see what the camera sees. It is intended primarily for server-side (i.e., driver-to-driver) data transfers, rather than server-to-client transfers. Image data can be in may formats (see below), but is always packed (i.e., pixel rows are byte-aligned).

This interface has no commands or configuration requests.

Version:
Author:
Radu Bogdan Rusu

Field Summary
static short PLAYER_CAMERA_COMPRESS_JPEG
           
static short PLAYER_CAMERA_COMPRESS_RAW
           
static short PLAYER_CAMERA_FORMAT_MONO16
          Image format : 16-bit monochrome (network byte order)
static short PLAYER_CAMERA_FORMAT_MONO8
          Image format : 8-bit monochrome
static short PLAYER_CAMERA_FORMAT_RGB565
          Image format : 16-bit color (5 bits R, 6 bits G, 5 bits B)
static short PLAYER_CAMERA_FORMAT_RGB888
          Image format : 24-bit color (8 bits R, 8 bits G, 8 bits B)
static short PLAYER_CAMERA_IMAGE_HEIGHT
           
static int PLAYER_CAMERA_IMAGE_SIZE
           
static short PLAYER_CAMERA_IMAGE_WIDTH
          Image dimensions
 
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
CameraInterface(PlayerClient pc, short indexOfDevice)
          Constructor for CameraInterface.
 
Method Summary
 byte getBPP()
          Returns the image bits-per-pixel (8, 16, 24, 32) value.
 byte getCompression()
          Returns the image compression status (PLAYER_CAMERA_COMPRESS_RAW indicates no compression.).
 short getFDiv()
          Some images (such as disparity maps) use scaled pixel values; for these images, fdiv specifies the scale divisor (i.e., divide the integer pixel value by fdiv to recover the real pixel value).
 byte getFormat()
          Returns the image format (must be compatible with depth).
 short getHeight()
          Returns the image height dimension.
 byte[] getImage()
          Returns the compressed image data (byte-aligned, row major order).
 int getImageSize()
          Returns the size of image data as stored in image buffer (bytes).
 short getWidth()
          Returns the image width dimension.
 void handleResponse(int size)
          Handle acknowledgement response messages (threaded mode).
 void readData()
          Read the camera data.

See the player_camera_data structure from player.h
 
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_CAMERA_IMAGE_WIDTH

public static final short PLAYER_CAMERA_IMAGE_WIDTH
Image dimensions

See Also:
Constant Field Values

PLAYER_CAMERA_IMAGE_HEIGHT

public static final short PLAYER_CAMERA_IMAGE_HEIGHT
See Also:
Constant Field Values

PLAYER_CAMERA_IMAGE_SIZE

public static final int PLAYER_CAMERA_IMAGE_SIZE
See Also:
Constant Field Values

PLAYER_CAMERA_FORMAT_MONO8

public static final short PLAYER_CAMERA_FORMAT_MONO8
Image format : 8-bit monochrome

See Also:
Constant Field Values

PLAYER_CAMERA_FORMAT_MONO16

public static final short PLAYER_CAMERA_FORMAT_MONO16
Image format : 16-bit monochrome (network byte order)

See Also:
Constant Field Values

PLAYER_CAMERA_FORMAT_RGB565

public static final short PLAYER_CAMERA_FORMAT_RGB565
Image format : 16-bit color (5 bits R, 6 bits G, 5 bits B)

See Also:
Constant Field Values

PLAYER_CAMERA_FORMAT_RGB888

public static final short PLAYER_CAMERA_FORMAT_RGB888
Image format : 24-bit color (8 bits R, 8 bits G, 8 bits B)

See Also:
Constant Field Values

PLAYER_CAMERA_COMPRESS_RAW

public static final short PLAYER_CAMERA_COMPRESS_RAW
See Also:
Constant Field Values

PLAYER_CAMERA_COMPRESS_JPEG

public static final short PLAYER_CAMERA_COMPRESS_JPEG
See Also:
Constant Field Values
Constructor Detail

CameraInterface

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

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

readData

public void readData()
Read the camera data.

See the player_camera_data structure from player.h

Overrides:
readData in class PlayerDevice

getWidth

public short getWidth()
Returns the image width dimension.

Returns:
the image width dimension as a short

getHeight

public short getHeight()
Returns the image height dimension.

Returns:
the image height dimension as a short

getBPP

public byte getBPP()
Returns the image bits-per-pixel (8, 16, 24, 32) value.

Returns:
the image bpp as a byte

getFormat

public byte getFormat()
Returns the image format (must be compatible with depth).

Returns:
the image format as a byte

getFDiv

public short getFDiv()
Some images (such as disparity maps) use scaled pixel values; for these images, fdiv specifies the scale divisor (i.e., divide the integer pixel value by fdiv to recover the real pixel value).

Returns:
the scale divisor as a short

getCompression

public byte getCompression()
Returns the image compression status (PLAYER_CAMERA_COMPRESS_RAW indicates no compression.).

Returns:
the image compression status as a byte

getImageSize

public int getImageSize()
Returns the size of image data as stored in image buffer (bytes).

Returns:
the image size as an integer

getImage

public byte[] getImage()
Returns the compressed image data (byte-aligned, row major order). Multi-byte image formats (such as MONO16) must be converted to network byte ordering.

Returns:
the image data as an array of bytes

handleResponse

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

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