blinkinput / blinkinput-android

BlinkOCR SDK for Android
https://microblink.com/ocr
104 stars 29 forks source link

Can't autofocus with webcam camera in emulator #31

Closed paymog closed 5 years ago

paymog commented 5 years ago

Before opening an issue, check that you are using the latest version of the BlinkInput SDK.

Also, make sure your issue isn't on the list of common problems.


Description

I'm using a MacBook Pro (13-inch, 2017) running an emulated device (Pixel 3 on api 28) with both the back and front camera using my webcam:

image

When I start the application and try to use the regex parser I get com.microblink.hardware.camera.AutoFocusRequiredButNotSupportedException: Autofocus is required, but not supported on this device in the logs and on the screen of the emulated device:

image

I suspect this is because the webcam doesn't support autofocus but I'm not entirely sure.

Environment Details

BlinkInput version: Not sure how to find version, here's the commit I'm on: 9019ee8b146e70cf2f6eb00dc70e8dc9792fae31

Device model: Emulated Pixel 3

Device Android version: 28

Device ABI (processor architecture, e.g. ARMv7): Unsure

Log file

05/16 16:53:39: Launching BlinkInputFieldByFieldSample
$ adb install-multiple -r -t -p com.microblink.input /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/split-apk/debug/dep/dependencies.apk /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/split-apk/debug/slices/slice_2.apk /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/split-apk/debug/slices/slice_0.apk /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/split-apk/debug/slices/slice_1.apk /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/split-apk/debug/slices/slice_3.apk /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/split-apk/debug/slices/slice_5.apk /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/split-apk/debug/slices/slice_4.apk /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/split-apk/debug/slices/slice_6.apk /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/split-apk/debug/slices/slice_7.apk /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/split-apk/debug/slices/slice_8.apk /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/split-apk/debug/slices/slice_9.apk /Users/paymahn/blinkinput-android/BlinkInputSample/BlinkInputFieldByFieldSample/build/intermediates/instant-run-apk/debug/BlinkInputFieldByFieldSample-debug.apk 
Split APKs installed in 3 s 124 ms
$ adb shell am start -n "com.microblink.input/com.microblink.input.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Waiting for process to come online
Waiting for process to come online
Connected to process 5366 on device emulator-5554
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
D/line:37: Unlocking BlinkInput native library version 4.0.0
D/OpenGLRenderer: Skia GL Pipeline
D/: HostConnection::get() New Host Connection established 0xe97362c0, tid 5404
I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/OpenGLRenderer: Swap behavior 0
D/EGL_emulation: eglCreateContext: 0xeb6052a0: maj 3 min 0 rcv 3
D/EGL_emulation: eglMakeCurrent: 0xeb6052a0: ver 3 0 (tinfo 0xeb6032a0)
D/EGL_emulation: eglMakeCurrent: 0xeb6052a0: ver 3 0 (tinfo 0xeb6032a0)
D/EGL_emulation: eglMakeCurrent: 0xeb6052a0: ver 3 0 (tinfo 0xeb6032a0)
D/EGL_emulation: eglMakeCurrent: 0xeb6052a0: ver 3 0 (tinfo 0xeb6032a0)
W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@1853d5c
D/line:103: OS name: Android
D/line:104: OS version: 9
D/line:105: Device name: generic_x86
D/line:106: Model: Android SDK built for x86
D/line:107: Manufacturer: Google
D/line:108: High quality: 1
D/line:109: Number of processors: 2
D/line:110: Max CPU frequency: -1 MHz
D/line:111: NEON supported: 0
D/line:113: Data: 
D/line:27: String map:
D/line:29: android.eglpbuffer.unsupported => false
    android.hwbuffer.allowed => false
I/CameraManagerGlobal: Connecting to camera service
D/line:260: This is Microblink's BlinkInput native library version 4.0.0
D/line:261: Built at 2018-05-16T18:37:52
E/RecognizerRunnerView.java:490@Camera2Control: Exception caught on camera startup
    com.microblink.hardware.camera.AutoFocusRequiredButNotSupportedException: Autofocus is required, but not supported on this device
        at com.microblink.secured.lIlIIIlIll.llIIlIlIIl(line:14687)
        at com.microblink.secured.lIlIIIlIll$1.run(line:312)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.microblink.secured.IIIlIIIIll$llIIlIlIIl.dispatchMessage(line:168)
        at android.os.Looper.loop(Looper.java:193)
        at com.microblink.secured.IIIlIIIIll.run(line:58)
E/FieldByFieldOverlayController.java:513@main: On error!
    com.microblink.hardware.camera.AutoFocusRequiredButNotSupportedException: Autofocus is required, but not supported on this device
        at com.microblink.secured.lIlIIIlIll.llIIlIlIIl(line:14687)
        at com.microblink.secured.lIlIIIlIll$1.run(line:312)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.microblink.secured.IIIlIIIIll$llIIlIlIIl.dispatchMessage(line:168)
        at android.os.Looper.loop(Looper.java:193)
        at com.microblink.secured.IIIlIIIIll.run(line:58)
W/lIlIIIlIll.java:19829@Camera2Control: Cannot start preview. CameraDevice: null, CameraSurface: com.microblink.secured.llIllIIlll@398923f, PreviewSize: null
D/EGL_emulation: eglMakeCurrent: 0xeb6052a0: ver 3 0 (tinfo 0xeb6032a0)
D/EGL_emulation: eglMakeCurrent: 0xeb6052a0: ver 3 0 (tinfo 0xeb6032a0)
I/chatty: uid=10085(com.microblink.input) RenderThread identical 2 lines
D/EGL_emulation: eglMakeCurrent: 0xeb6052a0: ver 3 0 (tinfo 0xeb6032a0)
D/EGL_emulation: eglMakeCurrent: 0xeb6052a0: ver 3 0 (tinfo 0xeb6032a0)
i1E commented 5 years ago

Hi @paymog,

I suspect this is because the webcam doesn't support autofocus but I'm not entirely sure.

You are right, please test the SDK on the real devices which have cameras with autofocus.

paymog commented 5 years ago

Yup, using a real device fixed the problem.