代码之家  ›  专栏  ›  技术社区  ›  Be Kind To New Users

条形码阅读器代码不解码条形码

  •  0
  • Be Kind To New Users  · 技术社区  · 6 年前

    此条形码:

    Sample Barcode

    不会解码。图像有什么问题,它无法解码。

    string barcodePng = "tmp.png";
    reader = new BarcodeReader();
    reader.Options.PossibleFormats = new List<BarcodeFormat>();
    reader.Options.PossibleFormats.Add(BarcodeFormat.CODE_39);
    reader.Options.TryHarder = true;
    using (var barcodeBitmap = new Bitmap(barcodePng))
    {
        var result = reader.Decode(barcodeBitmap);
        if (result != null)
        {
            Console.WriteLine("barcode did not decode");
        }
    }
    

    1 回复  |  直到 6 年前
        1
  •  1
  •   GSerg    6 年前

    它将不会解码,因为某些条形图由于低分辨率和模糊而合并和/或更改了其宽度。

    假设符号是 Code 39 ,有效条形码如下所示:

    推荐文章