Android 中 OCR 的 FOCUS_MODE 是什么
您建议使用哪种 FOCUS_MODE 来捕获随后由 OCR 处理的图像?我已阅读 API http://developer.android.com /reference/android/hardware/Camera.Parameters.html#FOCUS_MODE_AUTO 但我不确定该选择哪一个。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
FOCUS_MODE_AUTO
应该适用于 OCR。您可能想要实现某种定期调用焦点的循环。可以在 zxing 项目 此处。FOCUS_MODE_CONTINUOUS_PICTURE
,尤其是FOCUS_MODE_CONTINUOUS_VIDEO
似乎表现不佳 - 某些设备显然无法识别视图是否失焦,从而留下模糊的视图。为避免图像模糊,请勿在自动对焦周期运行时捕获视频帧进行 OCR。另请记住,
onAutoFocus()
回调可能会在自动对焦周期实际完成之前调用一点,因此您可能希望避免在收到回调时立即捕获 OCR 帧,因为它可能会变得模糊。另一种可能性是使用模糊检测算法来确定帧是否模糊,并通过请求自动对焦周期或捕获新帧来做出适当的反应。不过,如果不拒绝稍微失焦的帧,就很难做到这一点。
FOCUS_MODE_AUTO
should 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_PICTURE
and especiallyFOCUS_MODE_CONTINUOUS_VIDEO
seem 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.
我使用了 FOCUS_MODE_MACRO 和 SCENE_MODE_BARCODE 但我没有分析它是否有任何区别
I used FOCUS_MODE_MACRO and SCENE_MODE_BARCODE but I didn't analyse if it does make any difference