Label Definition
Defined in namespace Scandit.DataCapture.Label
- LabelDefinition
class LabelDefinition : IDisposable
Added in version 8.2.0
A configuration that defines labels and their relevant fields for Smart Label Capture to recognize and extract during scans. Label definitions provide flexible data extraction from specific label layouts without custom coding, enabling structured data extraction from diverse label types.
Label definitions support two primary approaches:
Pre-built Labels - Includes predefined configurations for common label types (price labels, VIN labels, 7-segment displays)
Custom Labels - Allows creating unique label definitions using custom barcode and text fields
Key configuration options for custom fields:
valueRegexes - Regular expressions to identify target strings
anchorRegexes - Context-identifying keywords for field recognition
symbologies - Specific barcode types to match
isOptional - Determines field requirement status
Pre-built field categories include:
Barcode Fields - Serial number, part number, IMEI
Price/Weight Fields - Unit price, total price, weight
Date/Text Fields - Packing date, expiry date
You can create label definitions in three ways:
- Create()
static LabelDefinition Create(
stringname, IList<LabelFieldDefinition> fields)Added in version 8.2.0
Create a new label definition with the given name and fields.
- Name
stringName { get; }Added in version 8.2.0
The name of the label definition.
- Fields
IReadOnlyList<
LabelFieldDefinition> Fields { get; }Added in version 8.2.0
The fields of the label definition.
- HiddenProperties
IDictionary<
string,object> HiddenProperties { get;set; }Added in version 8.2.0
Set properties to the label definition.
- AdaptiveRecognitionMode
AdaptiveRecognitionMode AdaptiveRecognitionMode { get;set; }
Added in version 8.2.0
Controls whether the Adaptive Recognition Engine is enabled for this label definition. The Adaptive Recognition Engine helps making Smart Label Capture more robust and scalable thanks to its larger, more capable model hosted in the cloud. Whenever Smart Label Capture’s on-device model fails to capture data, the SDK will automatically trigger the Adaptive Recognition Engine to capture complex, unforeseen data capture and process it with high accuracy and reliability. See AdaptiveRecognitionMode for available options. Defaults to AdaptiveRecognitionMode.Off.
- CreateVinLabelDefinition()
static LabelDefinition CreateVinLabelDefinition(
stringname)Added in version 8.2.0
Creates a predefined label definition for scanning Vehicle Identification Numbers (VIN). VIN codes are 17-character alphanumeric serial numbers that can appear as either text or barcodes on vehicles.
This factory method returns a label definition with two optional fields:
text - An optional text field for scanning VIN codes in text format with pattern
[A-Z0-9]{17}barcode - An optional barcode field for scanning VIN codes in barcode format (QR, Code 39, or Data Matrix symbologies) with pattern
[A-Z0-9]{17}
- CreatePriceCaptureDefinition()
static LabelDefinition CreatePriceCaptureDefinition(
stringname)Added in version 8.2.0
Creates a predefined label definition for scanning price labels on retail products. This factory method is designed for price checking scenarios where both barcode and price text need to be captured from product labels.
This factory method returns a label definition with two fields:
SKU - A mandatory barcode field for scanning Symbology.Ean13Upca and Symbology.Code128.
priceText - An optional text field for scanning price text using specialized price label recognition with pattern
\\d+.
You can easily disable one of the symbologies of the barcode field by changing global mode settings. For example, to disable Symbology.Code128 one can do this:
Note
To use this label definition, make sure to import the PriceCapture library.
Warning
This label definition is not intended for use in the Validation Flow. Using it there may result in incorrect data being captured for the label fields.
- CreateSevenSegmentDisplayLabelDefinition()
static LabelDefinition CreateSevenSegmentDisplayLabelDefinition(
stringname)Added in version 8.2.0
Creates a predefined label definition for reading numeric values from 7-segment displays, such as digital scales, meters, or other electronic displays.
This factory method returns a label definition with one field:
weight - A text field for 7-segment displays with pattern
[0-9OQB]{1,4}[\.\,\s]?[0-9OQB]{1,4}
The pattern accounts for common variations in 7-segment displays where certain characters may appear similar (e.g., ‘O’ for ‘0’, ‘Q’ for ‘0’, ‘B’ for ‘8’).