Will it be possible with camera 2 API?
@bhavesh-hirpara I believe that the Camera API you're using won't affect the functioning of these samples.
In case you are referring to the MLKit Sample where the Camera API is used, you can refer to the following reference doc to get up to speed on implementing the same functionality of converting an image to a FirebaseVisionImage by using the Camera2 API :
https://firebase.google.com/docs/ml-kit/android/recognize-text
cc @gkaldev
@the-dagger the android documentation says the following:
For the android.hardware.camera2 API, the YUV_420_888 format is recommended for YUV output instead.
While only NV21 and YV21 are supported by the firebase ml sdk ?
are we supposed convert on the fly wasting cpu cycles/battery or just configure camera2 to output NV21 ?
but then we wouldn't be following the recommendation.
I am not clear what drawbacks the recommendation tries to avoid.
The camera2 summary also repeats this recommendation:
Application-driven processing of camera data in RenderScript, OpenGL ES, or directly in managed or native code is best done through Allocation with a YUV Type, SurfaceTexture, and ImageReader with a YUV_420_888 format, respectively.
I think @samtstern or @gkaldev might be the best people to answer this.
why this example is not migrated to camera2?
If you don't need any of the fancy stuff that comes with Camera2, I highly recommend to use CameraView.
I made my custom Camera2 to process frames, based from this sample, however this sample uses Texture View, when seems like Surface Texture might be more appropriate.
I did ship with my custom Camera2 and CameraView(for legacy devices) and CameraView is waaaaay more efficient than my own Camera2.
Best part of CameraView is that I only wrote less than 10 lines of java code to have a very efficient camera for OCR Reader along with a QR Reader.
I am going to track all the camera improvements to this sample in #842
Most helpful comment
I think @samtstern or @gkaldev might be the best people to answer this.