Represents an image object that can be used for both on-device and cloud API detectors.
| static FirebaseVisionImage |
fromBitmap(Bitmap
bitmap)
Creates a
FirebaseVisionImage from a Bitmap,
where the object in the image should be already up-right and no rotation is
needed.
|
| static FirebaseVisionImage |
fromByteArray(byte[] byteArray,
FirebaseVisionImageMetadata metadata)
Creates a
FirebaseVisionImage from a byte array, e.g.
|
| static FirebaseVisionImage |
fromByteBuffer(ByteBuffer
byteBuffer,
FirebaseVisionImageMetadata metadata)
Creates a
FirebaseVisionImage from a ByteBuffer.
|
| static FirebaseVisionImage |
fromFilePath(Context
context, Uri
imageUri)
Creates a
FirebaseVisionImage from a local image file Uri.
|
| static FirebaseVisionImage | |
| Bitmap |
getBitmap()
Returns its bitmap representation.
|
Creates a
FirebaseVisionImage from a Bitmap,
where the object in the image should be already up-right and no rotation is needed.
Creates a
FirebaseVisionImage from a byte array, e.g. what you get from Camera
callback.
Creates a
FirebaseVisionImage from a ByteBuffer.
We assume the entire buffer from position zero to its limit is all image data.
Creates a
FirebaseVisionImage 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 a
FirebaseVisionImage from a Image object,
e.g. what you obtained from android.hardware.camera2
API.
Note that we only support JPEG / YUV_420_888 formats at this moment. If you are using cloud vision detectors, JPEG format is recommended; if you are using on-device detectors, YUV_420_888 will be more efficient.
After you get back a
FirebaseVisionImage, it's safe to close the input Image.
| image | |
|---|---|
| rotation | The camera rotation, e.g. ROTATION_90 for back camera landscape
mode. See also
FirebaseVisionImageMetadata.Rotation. |
Returns its bitmap representation.
The image will be rotated to up-right if it's created with rotation info via
setRotation(int).