IRONSOFTWAREHOME
设置条形码读取器选项
using IronBarCode;

BarcodeReaderOptions myOptionsExample = new BarcodeReaderOptions()
{
    // Choose a reading speed from: Faster, Balanced, Detailed, ExtremeDetail
    // There is a tradeoff in performance as more detail is set
    Speed = ReadingSpeed.Balanced,

    // Reader will stop scanning once a single barcode is found (if set to true)
    ExpectMultipleBarcodes = true,

    // By default, all barcode formats are scanned for
    // Specifying a subset of barcode types to search for would improve performance
    ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,

    // Utilize multiple threads to read barcodes from multiple images in parallel
    Multithreaded = true,

    // Maximum threads for parallelized barcode reading
    // Default is 4
    MaxParallelThreads = 2,

    // The area of each image frame in which to scan for barcodes
    // Specifying a crop area will significantly improve performance and avoid noisy parts of the image
    CropArea = new System.Drawing.Rectangle(),

    // Special setting for Code39 barcodes
    // If a Code39 barcode is detected, try to read with both the base and extended ASCII character sets
    UseCode39ExtendedMode = true,

    // Minimum scan lines that must agree on a result for it to be valid
    // Default is 2. Set to 1 for thin or low-quality barcodes
    MinScanLines = 1
};
Imports IronBarCode

Dim myOptionsExample As New BarcodeReaderOptions() With {
    .Speed = ReadingSpeed.Balanced,
    .ExpectMultipleBarcodes = True,
    .ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
    .Multithreaded = True,
    .MaxParallelThreads = 2,
    .CropArea = New System.Drawing.Rectangle(),
    .UseCode39ExtendedMode = True,
    .MinScanLines = 1
}
NuGet Download
PM > Install-Package BarCode
设置条形码读取器选项

设置条形码读取器选项

IronBarcode在BarcodeReaderOptions类内提供一系列设置,以实现定制和优化的条码读取。 这些选项允许您在资源和准确性之间进行权衡,控制阅读范围,并优化阅读策略。

可用的BarcodeReaderOptions类型

  • BarcodeReaderOptions:此类提供自定义条码读取的选项,使过程更加高效且准确以适应特定需要。
  • 1,读取器将在找到第一个条码后停止,从而在仅预期一个条码时提高性能。
  • TreatAllDecodersAs:自动检测条码类型,当您具有多样条码格式时简化过程。
  • CropRegion:允许聚焦在图像的特定区域,当大致知道条码位置时,可以显著提升读取时间和准确性。
  • MaxThreads:指定并行使用的最大线程数,提升多CPU核心系统的性能。
  • MinScanLines:设置必须同意条码结果的最小扫描线数量,以便视其为有效。 默认值为 2。将其调低至 1 可提高对细小或质量较差 BarCode 的识别灵敏度,而调高则可减少误报。

此配置可在资源利用、速度和准确性之间取得平衡,以满足您特定的条形码读取需求。

使用 IronBarcode 学习如何从图像中读取条形码
在 GitHub 上查看

准备开始了吗?

Nuget Downloads 2,422,100版本:2026.9刚刚发布

Key in blue circle

立即获取免费的 30 天试用版密钥

Your trial license will be sent to your email address

无任何限制。100% 解锁。无需信用卡。

bullet_checked无需信用卡或创建账户无任何限制。100% 解锁。无需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
预约您的免费现场演示
Booking Badge

深受全球数百万工程师信赖

Iron Software 的客户徽标
获取您的无义务咨询
填写下面的表格或通过sales@ironsoftware.com
您的资料将始终保密。
深受全球数百万工程师信赖
Iron Software 的客户徽标
立即获取您的免费30 天试用密钥
无需信用卡或创建账户