Class BarcodeReaderOptions
How ReadBarcodes<TPixel>(Raster<TPixel>, BarcodeReaderOptions?) searches an image.
public sealed record BarcodeReaderOptions : IEquatable<BarcodeReaderOptions>
- Inheritance
-
BarcodeReaderOptions
- Implements
- Inherited Members
Examples
// Only the formats you expect, searched harder; a rendered barcode can skip the search.
BarcodeResult? result = label.ReadBarcode(new BarcodeReaderOptions
{
Formats = BarcodeFormat.DataMatrix | BarcodeFormat.Qr,
Effort = 7,
});
if (result?.Gs1 is { } elements)
{
foreach (Gs1ElementString element in elements)
{
Console.WriteLine($"{element.Title}: {element.Value}");
}
}
BarcodeResult? rendered = label.ReadBarcode(new BarcodeReaderOptions { PureBarcode = true });
Properties
Context
Gets the context whose parallelism large images are searched with (binarized in stripes, the detectors side by side), or null for Default. Results never depend on the number of threads.
public EgamiContext? Context { get; init; }
Property Value
Default
Gets the defaults: every symbology, effort 5.
public static BarcodeReaderOptions Default { get; }
Property Value
Effort
Gets how hard to look, 0 to 10; 5 by default. Higher efforts try more binarizations, scan rows and rotations, and from 5 also inverted (light on dark) and mirrored symbols. Effort never changes what counts as a valid read.
public int Effort { get; init; }
Property Value
Exceptions
- ArgumentOutOfRangeException
The value is not 0 to 10.
Formats
Gets the symbologies to look for; All by default. Fewer formats read faster.
public BarcodeFormat Formats { get; init; }
Property Value
PureBarcode
Gets a value indicating whether the image holds one symbol, upright and unrotated, with only its quiet zone around it, as a rendered barcode does; such images are read without searching. Off by default.
public bool PureBarcode { get; init; }
Property Value
Region
Gets the part of the image to search, in pixels, or null, the default, for all of it.
public Rect? Region { get; init; }
Property Value
- Rect?
TryInverted
Gets a value indicating whether to look for light symbols on a dark background too, or null, the default, for from effort 5.
public bool? TryInverted { get; init; }
Property Value
- bool?