二维码识别
如何识别图像中的二维码并在检测到二维码时绘制一个正方形?我一直在使用 OpenCV 和 Visual Studio 2010 来检测一般的正方形,我想知道是否有类似的东西(例如,算法)来检测 QR 码。提前致谢。
How can I recognize QR codes in an image and draw a square when a QR code is detected? I have been working with OpenCV and Visual Studio 2010 detecting squares in general and I would want to know if there is something similar (for example,an algorithm) to that to detect QR codes. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上,ISO/IEC18004 中描述了一种检测 QR 码的算法。您必须寻找特定的模式 1:1:3:1:1(1 个深色模块:1 个浅色模块:3 个深色:1 个浅色:1 个深色)。然后你就有了 1 个查找器图案。然后你搜索另外两个,你就得到了方向……等等。
这很复杂,但这样可以很快地识别二维码。该算法在标准中以伪代码描述。要阅读,您必须付费购买一本。如果您计划实施 QR 码阅读器,则必须拥有它。
Actually there is an algorithm to detect QR Codes that is described in ISO/IEC18004. You have to look for a specific pattern 1:1:3:1:1 (1 dark module: 1 light module: 3 dark: 1 light : 1 dark). Then you have 1 finder pattern. Afterwards you search the other 2 and you get the orientation... etc.
It is quite complicated, but this way it is possible to recognize the QR Code quite fast. The algorithm is described in pseudo code in the standard. To read is you have to pay for a copy. It is essential to have it if you plan to implement a QR Code reader.
没有单一的最佳算法可以检测图像中的 QR 码。设计这样的算法是一门艺术,需要大量的尝试、错误和测试。
zxing 有一个 C++ 端口,其中包括 QR 码检测器和解码器。它经过调整,可以从手机摄像头实时检测代码,但也可以在其他设置下工作。当它检测到代码时,它会返回可用于提供视觉反馈的查找器位置。
我不知道将代码导入 VS 需要什么技能水平,但这样做似乎比尝试发明自己的检测器算法更容易处理。
There's no single best algorithm for detecting a QR code in an image. Designing such an algorithm is a bit of an art and entails a lot of trial and error and testing.
zxing has a C++ port that includes a QR code detector and decoder. It's tuned for detecting codes in real time from mobile phone cameras but works in other settings. When it detects a code, it returns the finder locations which can be used to provide visual feedback.
I don't know what skill level it would take to import that code into VS but it seems more tractable to do that than try to invent your own detector algorithm.