ByteBufferMlImageBuilder

public class ByteBufferMlImageBuilder extends Object

Builds a MlImage from a ByteBuffer.

You can pass in either mutable or immutable ByteBuffer. However once ByteBuffer is passed in, to keep data integrity you shouldn't modify content in it.

Use ByteBufferExtractor to get ByteBuffer you passed in.

Public Constructor Summary

ByteBufferMlImageBuilder(ByteBuffer byteBuffer, int width, int height, int imageFormat)
Creates the builder with mandatory ByteBuffer and the represented image.

Public Method Summary

MlImage
build()
Builds an MlImage instance.
ByteBufferMlImageBuilder
setRotation(int rotation)
Sets value for MlImage.getRotation().

Inherited Method Summary

Public Constructors

public ByteBufferMlImageBuilder (ByteBuffer byteBuffer, int width, int height, int imageFormat)

Creates the builder with mandatory ByteBuffer and the represented image.

We will validate the size of the byteBuffer with given width, height and imageFormat.

Also calls setRotation(int) to set the optional properties. If not set, the values will be set with default:

  • rotation: 0
Parameters
byteBuffer image data object.
width the width of the represented image.
height the height of the represented image.
imageFormat how the data encode the image.

Public Methods

public MlImage build ()

Builds an MlImage instance.

public ByteBufferMlImageBuilder setRotation (int rotation)

Sets value for MlImage.getRotation().

Throws
IllegalArgumentException if the rotation value is not 0, 90, 180 or 270.