Which FOCUS_MODE would you recommend to capture images which should be processed by OCR afterwards? I’ve 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.
Which FOCUS_MODE would you recommend to capture images which should be processed by OCR
Share
FOCUS_MODE_AUTOshould work well for OCR. You’ll probably want to implement some kind of loop that invokes the focus periodically. An example of code to do this can be found in the zxing project here.FOCUS_MODE_CONTINUOUS_PICTUREand especiallyFOCUS_MODE_CONTINUOUS_VIDEOseem to perform poorly–some devices apparently don’t recognize that the view is out of focus, leaving a blurry view.To avoid getting a blurry image, don’t capture a video frame for OCR while the autofocus cycle is running. Also keep in mind that the
onAutoFocus()callback may get called a little bit before the autofocus cycle has actually finished, so you may want to avoid immediately capturing a frame for OCR when you get the callback because it may turn out blurry.Another possibility is to use a blur detection algorithm to determine whether frames are blurry, and react appropriately by requesting an autofocus cycle or capturing a new frame. This can be hard to get right, though, without going overboard by rejecting frames that are just slightly out of focus.