AI-generated Key Takeaways
-
ByteBufferMlImageBuilder builds an MlImage from a ByteBuffer.
-
You can use mutable or immutable ByteBuffers but should not modify the content once passed in.
-
Use ByteBufferExtractor to retrieve the ByteBuffer that was passed in.
-
The builder requires a ByteBuffer, width, height, and image format to be created.
-
An optional rotation can be set for the MlImage.
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 | |
| 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 ByteBufferMlImageBuilder setRotation (int rotation)
Sets value for MlImage.getRotation().
Throws
| IllegalArgumentException | if the rotation value is not 0, 90, 180 or 270. |
|---|