读码时间太长了

我用 Barcode 解码,解码的时间很长有十几秒,而且没读出所有码。解码时间正常?可以提高?

@bys870,
谢谢你的查询。请与我们分享您的样本条形码图像和可运行的示例代码。我们将在此测试场景并提供反馈。

你好!代码如下:
OpenFileDialog ofd = new OpenFileDialog();

        if (ofd.ShowDialog() == DialogResult.OK)
        {
            Bitmap IMG = new Bitmap(ofd.FileName);
            BarCodeReader reader = new BarCodeReader(IMG, DecodeType.AllSupportedTypes);
            if(reader.Read())
            {
                string st = reader.GetCodeText();
               MessageBox.Show(st);
            }

3.zip (5.9 MB)
图片

@bys870,

谢谢你的图像文件。

这是预期的,因为你的样本图像(条形码)很大(10MB),这是不可理解的,Aspose.BarCode API可能需要几秒钟(在你的情况下,10秒)来传递它的对象模型读取条形码。

关于它没有读取图像中的所有条形码,嗯,您需要更新代码片段以获取所有条形码,请参阅我测试的示例代码片段正常工作:
例如
示例代码:

          Bitmap IMG = new Bitmap("e:\\test2\\3.bmp");
            
            using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader(IMG, Aspose.BarCode.BarCodeRecognition.DecodeType.AllSupportedTypes))
            {
                while (reader.Read())
                {
                    var barcode = reader.GetCodeText();
                    MessageBox.Show(barcode);
                }
            }

我希望这可以帮助你。