【问题标题】:Autorotate option for GenericMultipleBarcodeReader in Zxing.NetZxing.Net 中 GenericMultipleBarcodeReader 的自动旋转选项
【发布时间】:2016-11-04 14:54:34
【问题描述】:

如何在 Zxing.net 中为 'GenericMultipleBarcodeReader' 设置提示 'AutoRotate'。我已设置 Try_Harder = true。但没有从旋转图像中检测多个 1d/2d 条形码的结果。如果图像正确对齐,它会给出结果。

编辑:在“GenericMultipleBarcodeReader”中,我使用的是“ByQuadrantReader”。这可以从正确对齐的图像中检测条形码和二维码。对于旋转的图像,它找不到任何东西。

MultiFormatReader multiReader = new MultiFormatReader();
ZXing.Multi.GenericMultipleBarcodeReader byquadReader = new ZXing.Multi.GenericMultipleBarcodeReader(new ByQuadrantReader(multiReader));              
Dictionary<DecodeHintType, object> hints = new Dictionary<DecodeHintType, object>();
hints.Add(DecodeHintType.TRY_HARDER, true);
List<BarcodeFormat> formats = new List<BarcodeFormat>();
formats.Add(BarcodeFormat.All_1D);
formats.Add(BarcodeFormat.QR_CODE);
hints.Add(DecodeHintType.POSSIBLE_FORMATS, formats);
****
byquadresults = byquadReader.decodeMultiple(binaryBitmap, hints);

谁能帮帮我。

【问题讨论】:

    标签: c# zxing


    【解决方案1】:

    AutoRotate 只能与 BarcodeReader 类一起使用。

         var bitmap = (Bitmap)Bitmap.FromFile("<path to your image file>");
         var reader = new BarcodeReader
         {
            AutoRotate = true,
            Options = new DecodingOptions
            {
               TryHarder = true,
               PossibleFormats = new List<BarcodeFormat>
               {
                  BarcodeFormat.All_1D,
                  BarcodeFormat.QR_CODE
               }
            }
         };
    
         var results = reader.DecodeMultiple(bitmap);
    

    如果您想使用 ByQuadrantReader,您必须替换该行

    var reader = new BarcodeReader...
    

    var reader = new BarcodeReader(new ByQuadrantReader(new MultiFormatReader()), null, null)...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多