public class

VDARFrame

extends Object
java.lang.Object
   ↳ com.vidinoti.android.vdarsdk.VDARFrame

Class Overview

Describe a frame to be processed by the vision system.

The supported frame format are (examples are given for an image of size width x height):

  • YV12: Bi-Planar format with one plan containing the Y (luminance) values of the frame (the plane with thus have width x height byte elements), followed by one plane with interleaved chrominance values (U and V). This latest plane will thus have width/2 x height/2 pairs of U,V values yielding to plane of width*height/2 byte values. The first element of each pair is the U component.
  • NV12: [Android preferred native format] Bi-Planar format with one plan containing the Y (luminance) values of the frame (the plane with thus have width x height byte elements), followed by one plane with interleaved chrominance values (U and V). This latest plane will thus have width/2 x height/2 pairs of U,V values yielding to plane of width*height/2 byte values. The first element of each pair is the V component.

Summary

Nested Classes
enum VDARFrame.VDARFrameFormat Describe the supported frame format 
Public Constructors
VDARFrame(int width, int height, int bufferSizeYUV, VDARFrame.VDARFrameFormat format, boolean needBuffer)
Create a new frame object with the specified format
Public Methods
ByteBuffer getFrameBuffer()
Get and return the buffer to which the frame data should be stored.
VDARFrame.VDARFrameFormat getFrameFormat()
Return the current frame format
int getHeight()
Return the frame width in height.
byte[] getStandardBuffer()
int getWidth()
Return the frame width in pixels.
void setFrameBuffer(ByteBuffer b)
void setFrameFormat(VDARFrame.VDARFrameFormat frameFormat)
Set the frame format.
void setStandardBuffer(byte[] standardBuffer)
void setStandardBufferFromImage(Image img)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public VDARFrame (int width, int height, int bufferSizeYUV, VDARFrame.VDARFrameFormat format, boolean needBuffer)

Create a new frame object with the specified format

Parameters
format the format of the frame

Public Methods

public ByteBuffer getFrameBuffer ()

Get and return the buffer to which the frame data should be stored.

Warning: The frame buffer contains only width*height+width*height/2 bytes. If you try to write more bytes to the buffer, it is likely that your app will crash. Moreover, before writing to the buffer, you should rewind the buffer to the index 0 by calling the position(0) method on the buffer:

myFrame.getFrameBuffer().position(0); //Rewind the buffer before writing to it.

Returns
  • the frame buffer

public VDARFrame.VDARFrameFormat getFrameFormat ()

Return the current frame format

Returns
  • the frame format

public int getHeight ()

Return the frame width in height.

Returns
  • the frame height in pixels

public byte[] getStandardBuffer ()

public int getWidth ()

Return the frame width in pixels.

Returns
  • the frame width in pixels

public void setFrameBuffer (ByteBuffer b)

public void setFrameFormat (VDARFrame.VDARFrameFormat frameFormat)

Set the frame format.

Parameters
frameFormat the frameFormat to set

public void setStandardBuffer (byte[] standardBuffer)

public void setStandardBufferFromImage (Image img)