com.buglabs.bug.module.camera.pub
Interface ICamera2Device

All Known Implementing Classes:
CameraModlet

public interface ICamera2Device

An interface for a device that can return images.


Field Summary
static java.lang.String DEFAULT_MEDIA_NODE
          The default media node to specify when calling bug_camera_open().
 
Method Summary
 int cameraClose()
          Closes the camera - allowing other processes to abug_camera_openccess it.
 int cameraOpen(java.lang.String media_node, int slot_num, int full_height, int full_width, int preview_height, int preview_width)
          Opens a connection with a camera module and configure it.
 int cameraOpenDefault()
          Calls bug_camera_open with reasonable default values.
 int cameraStart()
          Start acquiring frames.
 int cameraStop()
          Stop acquiring frames.
 byte[] grabFull()
          Grabs a JPEG-encoded full image.
 boolean grabPreview(int[] pixelBuffer)
          Grabs a raw RGB-encoded preview image.
 boolean isCameraOpen()
           
 boolean isCameraStarted()
           
 

Field Detail

DEFAULT_MEDIA_NODE

static final java.lang.String DEFAULT_MEDIA_NODE
The default media node to specify when calling bug_camera_open().

See Also:
Constant Field Values
Method Detail

isCameraOpen

boolean isCameraOpen()

isCameraStarted

boolean isCameraStarted()

cameraOpen

int cameraOpen(java.lang.String media_node,
               int slot_num,
               int full_height,
               int full_width,
               int preview_height,
               int preview_width)
Opens a connection with a camera module and configure it.

Parameters:
media_node -
slot_num - the slot number of the camera module to use, or -1 to use the default (if there's only 1)
full_height - height in pixels to capture full images at
full_width - width in pixels to capture full images at
preview_height - height in pixels to capture preview images at
preview_width - width in pixels to capture preview images at
Returns:
0 if open was successful

cameraOpenDefault

int cameraOpenDefault()
Calls bug_camera_open with reasonable default values. (DEFAULT_MEDIA_NODE, -1, 2048, 1536, 320, 240)

Returns:
0 if open was successful

cameraClose

int cameraClose()
Closes the camera - allowing other processes to abug_camera_openccess it.

Returns:
0 if open was successful

cameraStart

int cameraStart()
Start acquiring frames. Must be called before the grab methods may be called.

Returns:
0 if start was successful

cameraStop

int cameraStop()
Stop acquiring frames.

Returns:
0 if stop was successful.

grabPreview

boolean grabPreview(int[] pixelBuffer)
Grabs a raw RGB-encoded preview image. bug_camera_open() and bug_camera_start() must already have been called.

Parameters:
pixelBuffer - array of size preview width * preview height from the call to open(). You can create such a buffer with: BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB); int [] buf = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
Returns:
true if grab succeeded

grabFull

byte[] grabFull()
Grabs a JPEG-encoded full image. bug_camera_open() and bug_camera_start() must already have been called.

Returns: