Zxing.Net 中 GenericMultipleBarcodeReader 的自动旋转选项

Autorotate option for GenericMultipleBarcodeReader in Zxing.Net

如何在 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);

谁能帮帮我

A​​utoRotate 只能用于 BarcodeReader class。

     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)...