Table of Contents

Class BarcodeMatchRule

Namespace
LMKit.Extraction.Barcodes
Assembly
LM-Kit.NET.dll

Which barcodes count for BarcodeSplitting. A barcode counts when it passes every rule that is set; an empty rule accepts every valid barcode.

public sealed class BarcodeMatchRule
Inheritance
BarcodeMatchRule
Inherited Members

Examples

using LMKit.Extraction.Barcodes;
using LMKit.Graphics.Geometry;

// Only QR codes reading "DOC-" followed by six digits, in the top quarter of the page.
var rule = new BarcodeMatchRule
{
    Formats = new[] { BarcodeFormat.QRCode },
    Pattern = @"^DOC-\d{6}$",
    SearchArea = Rectangle.FromSize(0, 0, 1, 0.25)
};

Remarks

Barcodes that are found but rejected are still reported, in IgnoredBarcodes, so a rule can be tuned from a real batch.

Properties

Formats

Gets or sets the formats that count; empty (the default) accepts every format. These formats also narrow what the reader looks for, which makes scanning faster.

MinimumSymbolSize

Gets or sets the smallest symbol that counts, in raster pixels along its longer side; 0 (the default) accepts every size.

Pattern

Gets or sets a regular expression the text must match (searched, not anchored); null accepts every text.

Predicate

Gets or sets a last test, given the barcode and its zero-based page index; null accepts every barcode.

RequireValid

Gets or sets whether only symbols that decoded without error count. Default: true.

SearchArea

Gets or sets the part of the page searched, as fractions of its width and height (0 to 1). Default: the whole page. The reader only looks inside it, which makes scanning faster and keeps unrelated barcodes out.

ValueComparison

Gets or sets how Values are compared. Default: Ordinal.

Values

Gets or sets exact values that count ("SEPARATOR", "NEXT-DOC"); empty accepts every value.

Methods

Clone()

Returns a copy of this rule.

IsMatch(BarcodeDetection, int)

Returns whether barcode, read on page pageIndex, counts.

Share