I was trying to use Android-vision api's for barcode scanning . Although barcode/QRcode scanning works , but to bring barcode/QRcode in focus you need to move your whole mobile back and forth. There does not look any inbuilt auto-focus mode . CameraSource class which manages native camera does not expose any way to get access to camera object. If auto focus is not performed then user will think that scanning itself is not working.
Also the sample "multi-tracker" app also does not perform any auto-focus.
Is there any way to do auto focus ?
When you create the CameraSource
through the Builder
, you can pass .setAutoFocusEnabled(true)
mCameraSource = new CameraSource.Builder()
.setRequestedPreviewSize(640, 480)
.setFacing(CameraSource.CAMERA_FACING_BACK)
.setRequestedFps(30.0f)
.setAutoFocusEnabled(true)
.build(getApplicationContext(), detector);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With