视觉API中的极限检测区域 [英] Limit Detection Area in Vision API

查看:111
本文介绍了视觉API中的极限检测区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎我发现自己在用于条形码扫描的Google Vision API的深草丛中。在查看了各种替代库(ZBar,ZXing甚至某些付费的第三方实现)后,也许我的想法有些沮丧,但是我在查找有关可在何处实现某种扫描的信息方面遇到了一些困难区域限制。

It seems I've found myself in the deep weeds of the Google Vision API for barcode scanning. Perhaps my mind is a bit fried after looking at all sorts of alternative libraries (ZBar, ZXing, and even some for-cost third party implementations), but I'm having some difficulty finding any information on where I can implement some sort of scan region limiting.

用例很简单:如果我是用户将手机指向带有多个相同类型条形码的盒子(请考虑运输标签)在这里),我想在屏幕上将一些小的取景器或对齐笔直指向我要捕获的东西,而不必担心感兴趣区域之外的任何东西会给我一些我不想要的扫描结果

The use case is a pretty simple one: if I'm a user pointing my phone at a box with multiple barcodes of the same type (think shipping labels here), I want to explicitly point some little viewfinder or alignment straight-edge on the screen at exactly the thing I'm trying to capture, without having to worry about anything outside that area of interest giving me some scan results I don't want.

上述情况在我见过的大多数其他Android库中都得到了处理,采用具有相对坐标或绝对坐标的Rect,这也是其中的一部分iOS的AVCapture元数据结果系统(它使用相对的CGRect,但实际上是相同的概念)。

The above case is handled in most other Android libraries I've seen, taking in either a Rect with relative or absolute coordinates, and this is also a part of iOS' AVCapture metadata results system (it uses a relative CGRect, but really the same concept).

我已经对s进行了深入研究条形码读取器
的功能强大的应用程序此处,但是除了要获取高级实现细节之外,实现还有些不透明。

I've dug pretty deep into the sample app for the barcode-reader here, but the implementation is a tad opaque to get anything but the high level implementation details down.

成功检测到条形码中任何位置的条形码似乎都是一个丑陋的补丁。摄像机的预览帧,直到感兴趣区域之外的条形码都可以简单无操作,因为设备仍在努力计算这些帧。

It seems an ugly patch to, on successful detection of a barcode anywhere within the camera's preview frame, to simple no-op on barcodes outside of an area of interest, since the device is still working hard to compute those frames.

我错过了一些东西吗?很简单,很明显吗?

Am I missing something very simple and obvious on this one? Any ideas on a way to implement this cleanly, otherwise?

非常感谢您阅读本文!

推荐答案

API当前没有限制检测区域的选项。但是您可以在预览图像传递到条形码检测器之前对其进行裁剪。请参见此处,了解如何使用您自己的课程包装探测器的概述:

The API currently does not have an option to limit the detection area. But you could crop the preview image before it gets passed into the barcode detector. See here for an outline of how to wrap a detector with your own class:

Mobile Vision API-连接新的检测器对象以继续进行帧处理

您将实现检测方法,以获取从摄像机接收到的帧,创建该帧的裁剪版本,并将其传递给基础检测器。

You'd implement the "detect" method to take the frame received from the camera, create a cropped version of the frame, and pass that through to the underlying detector.

这篇关于视觉API中的极限检测区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆