Frame

public class Frame extends Object

Image data with associated metadata.

A frame is constructed via the builder class, specifying the image data, dimensions, and sequencing information (frame ID, timestamp).

Nested Class Summary

class Frame.Builder Builder for creating a frame instance. 
class Frame.Metadata Frame metadata, describing the image dimensions, rotation, and sequencing information. 

Constant Summary

int ROTATION_0
int ROTATION_180
int ROTATION_270
int ROTATION_90

Public Method Summary

Bitmap
getBitmap()
Returns the bitmap which was specified in creating this frame, or null if no bitmap was used to create this frame.
ByteBuffer
getGrayscaleImageData()
Returns the grayscale version of the frame data, with one byte per pixel.
Frame.Metadata
getMetadata()
Returns the metadata associated with the frame.

Inherited Method Summary

Constants

public static final int ROTATION_0

Constant Value: 0

public static final int ROTATION_180

Constant Value: 2

public static final int ROTATION_270

Constant Value: 3

public static final int ROTATION_90

Constant Value: 1

Public Methods

public Bitmap getBitmap ()

Returns the bitmap which was specified in creating this frame, or null if no bitmap was used to create this frame. If the bitmap is not available, then getGrayscaleImageData() should be called instead.

public ByteBuffer getGrayscaleImageData ()

Returns the grayscale version of the frame data, with one byte per pixel. Note that the returned byte buffer will be prefixed by the Y channel (i.e., the grayscale image data), but may optionally include additional image data beyond the Y channel (this can be ignored).

If a bitmap was specified when creating this frame, the bitmap is first converted to a grayscale byte[] (allocation / copy required). It is recommended that you use the bitmap directly through getBitmap() if the associated native detection code supports it, since this would move the grayscale conversion into native code where it will be faster.

public Frame.Metadata getMetadata ()

Returns the metadata associated with the frame.