Android 中 OCR 的 FOCUS_MODE 是什么

发布于 2024-11-04 19:00:07 字数 284 浏览 3 评论 0原文

您建议使用哪种 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瀞厅☆埖开 2024-11-11 19:00:08

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 especially FOCUS_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.

如何视而不见 2024-11-11 19:00:08

我使用了 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文