Class for decoding. More...
Inherits INativeHandle.
Public Member Functions | |
void | Dispose () |
IDisposable implementation. | |
T | GetConfig< T > () |
Retrieves the typed configuration for the decoder. | |
IEnumerable< Result > | Execute (ImagePlane imagePlane, int numMaxCodes=0) |
Executes the decoding process on the specified image plane. | |
IEnumerable< Result > | Execute (ImagePlane imagePlane, Rect aoi, int numMaxCodes=0) |
Executes the decoding process on the specified image plane inside area of interest. | |
Static Public Member Functions | |
static Decoder | Create () |
Creates a decoder object. | |
static Decoder | FromHandle (IntPtr handle) |
Creates a decoder object from a handle. | |
Protected Member Functions | |
virtual void | Dispose (bool disposing) |
IDisposable helper function. | |
Properties | |
bool | BasicInkjetDPMEnabled [get, set] |
Enable/disable reading of Basic Inkjet DPM (Direct Part Marking). This mode can read poor quality inkjet images. | |
CustomPerformance | CustomPerformance [get, set] |
The custom image processing method to improve decoding robustness and performance. | |
int | DetectorDensity [get, set] |
Sets detector density to increase or decrease the search aggressiveness for small barcodes. | |
IntPtr | Handle [get] |
Native handle of the Decoder. | |
bool | IsDisposed [get] |
Gets if the native handle has been disposed. | |
Events | |
NativeHandleEventDelegate | ObjectDisposing |
Raised when this object is about to be disposed via the IDisposable.Dispose method. | |
![]() | |
NativeHandleEventDelegate | ObjectDisposing |
Raised when this object is about to be disposed via the IDisposable.Dispose method. | |
Class for decoding.
This class provides the core functionality for detecting and decoding codes in images. Each code type can be configured using its corresponding configuration class.
To decode an image containing a supported code, start by creating a decoder. You can configure your decoder using the member function Decoder.GetConfig<T>
which returns a reference to the desired configuration class.
After configuring the decoder, load an image containing the code(s) and execute the decoding process.The following code snippet demonstrates how to decode an image containing Data Matrix and QR codes:
|
protectedvirtual |
IDisposable helper function.
disposing |
IEnumerable< Result > Execute | ( | ImagePlane | imagePlane, |
int | numMaxCodes = 0 ) |
Executes the decoding process on the specified image plane.
Before execution, ensure that you have configured the decoder using Decoder.GetConfig<T>
. If you wish to restrict the search area, you can utilize the overloaded function Execute(ImagePlane, Rect, int).
imagePlane | The image plane containing the code. |
numMaxCodes | Maximum number of codes to detect. 0 for no limit (up to 256). |
ObjectDisposedException | When this decoder or the parent of the imagePlane is disposed. |
ArgumentNullException | When parent of imagePlane is null. |
IEnumerable< Result > Execute | ( | ImagePlane | imagePlane, |
Rect | aoi, | ||
int | numMaxCodes = 0 ) |
Executes the decoding process on the specified image plane inside area of interest.
Detailed information can be found in the description of function Execute(ImagePlane, int).
imagePlane | The image plane containing the code. |
aoi | Area of interest. |
numMaxCodes | Maximum number of codes to detect. 0 for no limit (up to 256). |
ObjectDisposedException | When this decoder or the parent of the imagePlane is disposed. |
ArgumentNullException | When parent of imagePlane is null. |
|
static |
T GetConfig< T > | ( | ) |
Retrieves the typed configuration for the decoder.
After a decoder is created with Create and before starting the decoding process with Execute, you should configure your decoder. The following code snippet shows exemplarily how to enable and configure the decoding of Data Matrix codes:
Note that you can enable and configure multiple code types simultaneously. The classes for all supported code types can be found within the Config namespace.
Alternatively, you can utilize the fluent interface pattern for seamless configuration:
T | The class representing the code type. |
T | : | ConfigBase |
|
getset |
Enable/disable reading of Basic Inkjet DPM (Direct Part Marking). This mode can read poor quality inkjet images.
|
getset |
Sets detector density to increase or decrease the search aggressiveness for small barcodes.
Setting it to a lower value can improve robustness of decoding smaller barcodes or poorly formed 2D codes, but will also increase the decoding time. Setting to a higher value will speed up decoding with reduced robustness for decoding smaller barcodes. The default setting is 3. Value must be between 1 and 4 (inclusive).
ArgumentOutOfRangeException | If value not between 1 and 4 (inclusive).> |
NativeHandleEventDelegate ObjectDisposing |
Raised when this object is about to be disposed via the IDisposable.Dispose method.
This event is raised right before this object is disposed. The dispose itself cannot be canceled.