简体   繁体   English

如何从 C# 中的图片中检测(以及稍后解析)二维码?

[英]How to detect (and later - parse) QR code from a picture in C#?

I am now reviewing a rather complex task - how to detect QR code on a picture?我现在正在审查一个相当复杂的任务——如何检测图片上的二维码? I have checked such solutions as ZXing.NET, even some proprietary libraries.我检查过 ZXing.NET 之类的解决方案,甚至是一些专有库。 QR code has a remarkable pattern - it always has three black squares.二维码有一个非凡的图案——它总是有三个黑色方块。

Do I need to use neural networks and CUDA for recognizing QR code on picture?我需要使用神经网络和 CUDA 来识别图片上的二维码吗?

I have found similar project which may be helpful: https://www.codeproject.com/Articles/1250071/QR-Code-Encoder-and-Decoder-NET-Framework-Standard , but I am curious to know the overall principles and concepts behind it.我发现类似的项目可能会有所帮助: https://www.codeproject.com/Articles/1250071/QR-Code-Encoder-and-Decoder-NET-Framework-Standard ,但我很想知道总体原理和背后的概念。

What actions should I take to dispatch it on picture, considering that it may be skewed/rotated?考虑到它可能会倾斜/旋转,我应该采取什么措施将其发送到图片上?

In most computer vision software, it's done way simpler than all the things you describe.在大多数计算机视觉软件中,它比你描述的所有东西都简单。

The QR code is black and white, and that contrast is what matters.二维码是黑白的,对比才是最重要的。 The QR code has 3 big black dots in the corners which are used to find the QR code and the orientation.二维码的角上有3个大黑点,用于查找二维码和方向。 These are called finder patterns.这些被称为查找器模式。 This picture gives a nice overview:这张图片提供了一个很好的概述:

在此处输入图像描述 Source, which has great explanation on the concept.来源,对这个概念有很好的解释。

More on finder/alignment有关取景器/对齐的更多信息

Data in qr codes are kept with some redundancy, so the same data may be incorporated 3 times, so that any wrinkles or damages to the qr code can still be picked up.二维码中的数据保留了一些冗余,因此相同的数据可能会合并3次,因此仍然可以拾取二维码的任何皱纹或损坏。

There are lots of resources online.网上有很多资源。 OpenCv (open computer vision) is a popular open source library for computer vision, maybe there is a QR-code module in there? OpenCv(开放计算机视觉)是一个流行的计算机视觉开源库,也许里面有一个二维码模块?

Here 's sample implementation that looks good. 是看起来不错的示例实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM