googlesamples / mlkit

A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug report] InputImage.getBitmapInternal() returns null

arianaa30 opened this issue · comments

I am trying to convert an object of type Image into Bitmap so to attach it to a Canvas object after MLKit processing. But when calling inputImage.getBitmapInternal() it returns null. Is it a bug?

Image image = imageReader.acquireLatestImage();
       
InputImage inputImage = InputImage.fromMediaImage(image, rotation);
Bitmap bitmap= inputImage.getBitmapInternal();
//.... 
canvas.drawBitmap(bitmap, 0, 0, new Paint(Paint.ANTI_ALIAS_FLAG));

getBitmapInternal is not the public API, which should not be used by developer.

In your case you should convert it yourself from media image to bitmap