解码倒置二维码zxing

发布于 2024-12-29 01:33:38 字数 152 浏览 3 评论 0原文

我发现 FinderPatternFinder 类中有一个名为“int[] stateCount”的变量,有助于检查 QR 码中任何可能的查找模式。为了检测/定位查找器模式,我认为更改此变量会有所帮助。 关于如何使用 ZXing 在 Java 中检测/解码颜色反转的 QR 码有什么想法吗?

I found that there is a variable, called "int[] stateCount", in FinderPatternFinder class helps checking for any possible finder pattern in a QR code. In order to detect/locate the Finder Patterns, I am thinking to make changes of this variable would be helpful.
Any ideas on how to detect/decode a color inverted QR code in Java with ZXing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

你的心境我的脸 2025-01-05 01:33:38

我不是一个java程序员,但是由于我已经成功地改变了zxing源代码以在我的iOS项目中实现扫描反码,也许我的实现会对你有所帮助。

反转像素 - zxing

I'm not a java programer but since I have managed to alter the zxing source to implement scanning inverted codes in my iOS project maybe my implementation will help you.

Invert pixels - zxing

所谓喜欢 2025-01-05 01:33:38

不确定颜色反转是什么意思。你的意思是交换光明和黑暗吗?理论上,您应该能够拍摄图像、提取亮度并将其反转,例如255-pixel_luminance。请注意,安静区域(白色周围)也需要反转,即黑色周围。而且这可能无论如何都行不通。 zxing 启发式并不总是对称的。你可以尝试一下,但可能行不通。

请注意,zxing 仅提取亮度。检测器/解码器无法区分色调截然不同但亮度相同的两种颜色。

无论如何,使用 stateCount 进行清理可能不会有帮助。此时,图像是纯黑白的,甚至没有灰度。您希望在此之前考虑图像中的任何变化/扭曲,并保持此代码不变。

Not sure what you mean by color inverted. Do you mean swapping light and dark? In theory, you should be able to take an image, extract the luminance, and invert it, e.g., 255-pixel_luminance. Note that the quiet zone (surrounding white) needs to be inverted as well, i.e., surrounding black. And it's possible this won't work anyway. The zxing heuristics are not always symmetric. You can give it a shot but it may not work.

Note that zxing only extracts luminance. Two colors of very different hues but the same luminance are indistinguishable to the detectors/decoders.

In any case, mucking with stateCount is probably not going to help. At that point, the image is purely black and white, not even grayscale. You want to take any variations/distortions in your image into account ahead of this and leave this code untouched.

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