c# - How to detect barcodes when they are arranged horizontally and vertically at the same time with ZXing.NET? - Stack Overflow

I have this 3 situations:BarCode1.jpg : 2 Barcodes code 128 and 2 Barcodes 39=>All codes are read c

I have this 3 situations: BarCode1.jpg : 2 Barcodes code 128 and 2 Barcodes 39=>All codes are read correctly

CODE_39[39;210;327;210] : ABC-1234
CODE_128[33;105;319;105] : ABC-abc-1234
CODE_128[424;52;600;52] : 123456787
CODE_39[404;213;628;213] : 123456

BarCode2.jpg : 2 Barcodes code 128 (1 horizontal and 1 vertical) and 2 Barcodes 39(1 horizontal and 1 vertical)=>Only horizontal codes are read correctly

CODE_39[39;210;327;210] : ABC-1234
CODE_128[33;105;319;105] : ABC-abc-1234

BarCode3.jpg : 2 Barcodes code 128 (1 horizontal and 1 vertical) and 3 Barcodes 39(2 horizontal and 1 vertical)=>Only horizontal codes are read correctly and the duplicate code was ignored.

CODE_39[39;267;327;267] : ABC-1234
CODE_128[33;133;319;133] : ABC-abc-1234

My code is very simple

private string ScanBarcode(Bitmap bitmap)
{
    Bitmap target;
    var reader = new ZXing.Windows.Compatibility.BarcodeReader()
    {
        AutoRotate = true,
        Options = new DecodingOptions
        {
            TryHarder = true,
            PureBarcode = false,
            ReturnCodabarStartEnd = true,
        }
    };
    Result[] result = reader.DecodeMultiple(bitmap);
    if (result==null) return "not found";
    string barcodeResult = "";
    foreach (var res in result)
    {
        barcodeResult += res.BarcodeFormat.ToString() +"[" +res.ResultPoints[0].X +";"+ res.ResultPoints[0].Y +";" +res.ResultPoints[1].X + ";" + res.ResultPoints[1].Y + "]" + " : " + res.Text + "\r\n";
    }
    return barcodeResult;
}

I'm using ZXing.Windows.Compatibility (0.16.13.0) and ZXing (0.16.10.0)

My questions are:

  1. Exists an option to force read all barcodes regardless of orientation?
  2. Exists an option to force read all barcodes regardless of whether they are duplicated?

The case of duplication is weird but we have some forms where the same barcode is duplicated, I think, for redundancy reasons if the form is scratched out, but I would still like to get the position of both barcodes.

Thanks

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744836423a4596288.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信