バーコードリーダーのオプションを設定する
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
};
NuGetダウンロード
PM > Install-Package BarCode
バーコードリーダーのオプションを設定する

バーコードリーダーのオプションを設定する

IronBarcodeでは、BarcodeReaderOptionsクラス内で、カスタマイズされた最適化されたバーコード読み取りを可能にするさまざまな設定を提供しています。 これらのオプションは、リソースと精度をトレードオフしたり、読み取りの範囲を制御したり、読み取り戦略を最適化したりすることができます。

利用可能なBarcodeReaderOptionsタイプ

  • BarcodeReaderOptions: このクラスは、バーコードの読み取りをカスタマイズするためのオプションを提供し、特定のニーズに基づいてプロセスをより効率的かつ正確にします。
  • ExpectMultipleBarcodes: これをfalseに設定すると、最初のバーコードを見つけた時点でリーダーが停止し、1つのバーコードのみが予想される場合にパフォーマンスが向上します。
  • ExpectBarcodeTypes: スキャン対象のBarcodeEncodingタイプを指定することで、異なるバーコードフォーマットを扱う際にプロセスを簡素化します。
  • CropArea: 画像内の特定の領域に焦点を合わせることを可能にし、バーコードの位置がおおよそ分かっている場合に読み取り時間と精度を大幅に向上させます。
  • MaxParallelThreads: プロセスに使用される最大スレッド数を指定することで、複数のCPUコアを持つシステム上でのパフォーマンスを向上させます。
  • MinScanLines: バーコードの結果を有効と見なすために合意する必要がある最小スキャンライン数を設定します。 デフォルトは 2 です。これを 1 に下げると、薄かったり品質の低い BARCODE に対する感度が上がり、逆に上げると誤検出が減少します。

この構成は、リソース使用量、速度、精度のバランスを取りながら、特定のバーコード読み取りニーズに合わせて調整されています。

IronBarcodeで画像からバーコードを読み取る方法を学ぶ
GitHubで表示

準備はできましたか?

NuGetダウンロード数 2,575,633バージョン:2026.11ちょうどリリースされました