ZXING端口解码二维码失败
我正在使用 zxing C# 端口来解码 QR 条形码。 代码很简单,基于我在网上找到的示例(见下文)。
问题是,它总是抛出“索引超出数组范围”异常。
我的代码示例恰好在 VB.NET 中,但 zxing 库是用 C# 实现的。
Dim re As qrcode.QRCodeReader
re = New qrcode.QRCodeReader()
Dim Img As New Bitmap("<image file path here>")
Dim res As com.google.zxing.Result
Dim bufimg As com.google.zxing.client.j2se.BufferedImageMonochromeBitmapSource
bufimg = New client.j2se.BufferedImageMonochromeBitmapSource(Img, False)
res = re.decode(bufimg)
Dim ret As String = res.getText()
我看到很多人在不同的论坛上抱怨同样的问题,但没有找到任何建议的解决方案。
更新 如果有人知道可以轻松与 .NET 应用程序集成的其他优秀 QR 阅读器,请推荐
I'm using the zxing C# port to decode a QR barcode.
The code is simple and based on an example I found online (see below).
The problem is, it always throws an "Index was outside the bounds of the array" exception.
My code sample happen to be in VB.NET, but the zxing library is implemented in C#
Dim re As qrcode.QRCodeReader
re = New qrcode.QRCodeReader()
Dim Img As New Bitmap("<image file path here>")
Dim res As com.google.zxing.Result
Dim bufimg As com.google.zxing.client.j2se.BufferedImageMonochromeBitmapSource
bufimg = New client.j2se.BufferedImageMonochromeBitmapSource(Img, False)
res = re.decode(bufimg)
Dim ret As String = res.getText()
I have seen multiple people complaining about the same issue in different forums, but haven't found any suggested solution.
UPDATE If anyone knows of a different good QR reader that can easily integrate with a .NET application, please recommend
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不知道这是否对您有帮助,但如果您想使用,我粘贴我的代码:
Dont know if this gonna help u, but i paste my code if u want to use: