MlImageAdapter

Stay organized with collections Save and categorize content based on your preferences.
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

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.