Represents an image object.
| @interface | InputImage.ImageFormat | Accepted image format of vision APIs. | |
| int | IMAGE_FORMAT_NV21 | See ImageFormat.NV21. |
| int | IMAGE_FORMAT_YUV_420_888 | See ImageFormat.YUV_420_888. |
| int | IMAGE_FORMAT_YV12 | See ImageFormat.YV12. |
| static InputImage | |
| static InputImage |
fromByteArray(byte[] byteArray, int width, int height, int
rotationDegrees, int format)
Creates an
InputImage
from a byte array, e.g., what you get from Camera
callback.
|
| static InputImage |
fromByteBuffer(ByteBuffer
byteBuffer, int width, int height, int rotationDegrees, int format)
Creates an
InputImage
from a ByteBuffer.
|
| static InputImage | |
| static InputImage |
fromMediaImage(Image image, int
rotationDegrees)
Creates an
InputImage
from an Image
object, e.g., what you obtained from android.hardware.camera2
API.
|
See ImageFormat.NV21.
See ImageFormat.YV12.
Creates an InputImage
from a Bitmap.
| bitmap | the input Bitmap. |
|---|---|
| rotationDegrees | the image's counter-clockwise orientation degrees. Only 0, 90, 180, 270 are supported. IllegalArgumentException will be thrown if the input degree is not in the list. |
Creates an InputImage
from a byte array, e.g., what you get from Camera
callback.
| byteArray | the content of the image |
|---|---|
| width | the width of the image |
| height | the height of the image |
| rotationDegrees | the image's counter-clockwise orientation degrees. Only 0, 90, 180, 270 are supported. IllegalArgumentException will be thrown if the input degree is not in the list. |
| format | the image format. The supported formats are
IMAGE_FORMAT_NV21 and
IMAGE_FORMAT_YV12. For IMAGE_FORMAT_YUV_420_888, please use
fromMediaImage(Image, int). |
Creates an InputImage
from a ByteBuffer.
We assume the entire buffer from position zero to its limit is all image data.
| byteBuffer | the content of the image |
|---|---|
| width | the width of the image |
| height | the height of the image |
| rotationDegrees | the image's counter-clockwise orientation degrees. Only 0, 90, 180, 270 are supported. IllegalArgumentException will be thrown if the input degree is not in the list. |
| format | the image format. The supported formats are
IMAGE_FORMAT_NV21 and
IMAGE_FORMAT_YV12. For IMAGE_FORMAT_YUV_420_888, please use
fromMediaImage(Image, int). |
Creates an InputImage
from a local image file Uri.
| IOException | if the image could not be retrieved from the specified imageUri. This could happen even if the Uri came from content chooser, e.g., some users might have content providers for remote resources. |
|---|
Creates an InputImage
from an Image object,
e.g., what you obtained from android.hardware.camera2
API.
Please wait for the detector to finish processing this InputImage
before you close the underlying Image.
| image | the android.media.Image, where only JPEG / YUV_420_888 formats are supported at this moment and YUV_420_888 is more efficient for all our APIs. |
|---|---|
| rotationDegrees | the image's counter-clockwise orientation degrees. Only 0, 90, 180, 270 are supported. IllegalArgumentException will be thrown if the input degree is not in the list. |