我正在尝试读取 USB 相机获取的图像中的二维码。在其他帖子中,我读到最好的开源库是 ZXing。
如果二维码来自数字生成的图像,则库工作正常,但如果二维码来自图像由相机获取的真实情况,则解码库会遇到一些困难。
所获取的图像会受到一些眩光、代码变形或对比度缓慢的干扰。
您知道一些参数可以更好地设置阅读器吗?或者在详细说明之前添加一些过滤器到图像中?
例如:
BarcodeReader reader = new BarcodeReader();
reader.AutoRotate = true;
reader.Options.TryHarder = true;
reader.Options.PureBarcode = false;
reader.Options.PossibleFormats = new List<BarcodeFormat>();
reader.Options.PossibleFormats.Add(BarcodeFormat.QR_CODE);
var result = reader.Decode(image);
Run Code Online (Sandbox Code Playgroud)
谢谢