What is FOCUS_MODE for OCR in Android

What FOCUS_MODE do you recommend for capturing images that need to be processed by OCR afterwards? I read the API http://developer.android.com/reference/android/hardware/Camera.Parameters.html#FOCUS_MODE_AUTO , but I'm not sure which one to choose.

+4
source share
2 answers

FOCUS_MODE_AUTO should work well for OCR. You probably want to implement some kind of loop that periodically causes focus. Sample code for this can be found in the zxing project here .

FOCUS_MODE_CONTINUOUS_PICTURE and especially FOCUS_MODE_CONTINUOUS_VIDEO seem to work poorly - some devices do not seem to realize that the view is out of focus, leaving a blurry view.

To avoid blurry images, do not shoot a video frame for OCR during the autofocus cycle. Also keep in mind that the onAutoFocus() can be called a bit before the autofocus cycle is really finished, so you can avoid immediately capturing the frame for OCR when you receive the callback because it may be blurry.

Another possibility is to use the blur detection algorithm to determine if the frames are blurry and to respond appropriately by requesting an autofocus cycle or capturing a new frame. It can be hard to get, though, without going overboard, rejecting frames that are slightly out of focus.

+3
source

I used FOCUS_MODE_MACRO and SCENE_MODE_BARCODE, but I did not analyze it, it does not matter

+1
source

All Articles