October 2018
Intermediate to advanced
246 pages
6h 26m
English
Let's create this instance of a FirebaseVisionImage using a media.Image instance . This may occur when capturing an image from the device's camera. When doing so, we must pass the instance of this image as well as the rotation of it, so this must be calculated prior to calling the fromMediaImage() function.
The rotation function is as follows:
private static final SparseIntArray ORIENTATIONS = new SparseIntArray();static { ORIENTATIONS.append(Surface.ROTATION_0, 90); ORIENTATIONS.append(Surface.ROTATION_90, 0); ORIENTATIONS.append(Surface.ROTATION_180, 270); ORIENTATIONS.append(Surface.ROTATION_270, 180);}/** * Get the angle by which an image must be rotated given the device's current orientation. */@RequiresApi(api =
Read now
Unlock full access