MlImageAdapter

public class MlImageAdapter

Converts MlImage to TensorImage and vice versa.

Public Methods

static ColorSpaceType
createColorSpaceTypeFrom(int imageFormat)
Creatas a ColorSpaceType from MlImage.ImageFormat.
static TensorImage
createTensorImageFrom(MlImage mlImage)
Creates a TensorImage from an MlImage.

Inherited Methods

boolean
equals(Object arg0)
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()

Public Methods

public static ColorSpaceType createColorSpaceTypeFrom (int imageFormat)

Creatas a ColorSpaceType from MlImage.ImageFormat.

Parameters
imageFormat

public static TensorImage createTensorImageFrom (MlImage mlImage)

Creates a TensorImage from an MlImage.

IMPORTANT: The returned TensorImage shares storage with mlImage, so do not modify the contained object in the TensorImage, as MlImage expects its contained data are immutable. Also, callers should use MlImage#getInternal()#acquire() and MlImage#release() to avoid the mlImage being released unexpectedly.

Parameters
mlImage
Throws
IllegalArgumentException if the mlImage is built from an unsupported container.