Thanks for downloading Dynamsoft Barcode Reader Package!
Your download will start shortly. If your download does not begin, click here to retry.
RegionPredetectionModes
is a parameter to control how to find a region of interesting. It consisits of one or more modes, each mode represents a way to find a region.
Lets the library choose a mode automatically.
Takes the whole image as a region. This mode has the following arguments for further customizing.
Detects region using the general algorithm based on RGB colour contrast. This mode has the following arguments for further customizing.
Detects region using the general algorithm based on gray contrast. This mode has the following arguments for further customizing.
Detects region using the general algorithm based on HSV colour contrast. This mode has the following arguments for further customizing.
PublicRuntimeSettings
MemberRegionPredetectionModes
can be set dynamically during runtime as a member of FurtherModes
, which is a member of PublicRuntimeSettings
struct, it is an array with 8 RegionPredetectionMode
Enumeration items.
Code Snippet in C++
//...other codes
PublicRuntimeSettings* pSettings = new PublicRuntimeSettings;
int errorCode = reader->GetRuntimeSettings(pSettings);
pSettings->regionPredetectionModes[0] = RPM_GENERAL_RGB_CONTRAST;
reader->UpdateRuntimeSettings(pSettings);
reader->SetModeArgument("RegionPredetectionModes", 0, "Sensitivity", "5");
delete pSettings;
//...other codes
Remarks
GetModeArgument
and SetModeArgument
need to be called for getting and setting Arguments
.
See Also
FurtherModes:
C | C++ | .NET | Java | Java-Android | Objective-C & SwiftPublicRuntimeSettings:
JavaScript | C | C++ | .NET | Python | Java | Java-Android | Objective-C & SwiftRegionPredetectionMode
EnumerationGetModeArgument:
JavaScript | C | C++ | .NET | Python | Java | Java-Android | Objective-C & SwiftSetModeArgument:
JavaScript | C | C++ | .NET | Python | Java | Java-Android | Objective-C & SwiftRegionPredetectionModes
as a JSON parameter is a JSON Object array. Each JSON object is defined as below.
Key Name | Key Value | Description |
---|---|---|
Mode | Any one in Candidate Mode List as string | (Required) Specifies a mode to find a region. |
AspectRatioRange | A string from value range of AspectRatioRange | (Optional) Sets the Argument AspectRatioRange. |
ForeAndBackgroundColours | A string from value range of ForeAndBackgroundColours | (Optional) Sets the Argument ForeAndBackgroundColours. |
HeightRange | A string from value range of HeightRange | (Optional) Sets the Argument HeightRange. |
MinImageDimension | A number from value range of MinImageDimension | (Optional) Sets the Argument MinImageDimension. |
RelativeBarcodeRegions | A string from value range of RelativeBarcodeRegions | (Optional) Sets the Argument RelativeBarcodeRegions. |
Sensitivity | A number from value range of Sensitivity | (Optional) Sets the Argument Sensitivity. |
SpatialIndexBlockSize | A number from value range of SpatialIndexBlockSize | (Optional) Sets the Argument SpatialIndexBlockSize. |
WidthRange | A string from value range of WidthRange | (Optional) Sets the Argument WidthRange. |
LibraryFileName | A string from value range of LibraryFileName | (Optional) Sets the Argument LibraryFileName. |
LibraryParameters | A string from value range of LibraryFileName | (Optional) Sets the Argument LibraryFileName. |
JSON Parameter Example
{
"RegionPredetectionModes": [
{
"Mode": "RPM_GENERAL_RGB_CONTRAST",
"Sensitivity": 5
},
{
"Mode": "RPM_GENERAL_HSV_CONTRAST",
"WidthRange": "[100, 200]"
}
]
}
The SDK will loop the setting modes one by one until find as many barcodes as ExpectedBarcodesCount
specified or timeout. The more modes you set, the more time the process may take. Setting an appropriate mode first in order or setting only necessary modes may speed up the process.
Enabling region predetection on images with obvious colour features may speed up the process.
Setting more modes along with different arguments may improve the Read Rate.
RegionPredetectionModes
has no influence on the Accuracy.
Specifies a set (or multiple sets) of aspect ratio range for filtering the predetected region.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
string | A string value representing aspect ratio range sets. | ”” | RPM_GENERAL_HSV_CONTRAST |
Remarks
MinAspectRatio
, MaxAspectRatio
].MinAspectRatio
, MaxAspectRatio
: [1,10000]Specifies a set (or multiple sets) of the foreground and background colours used for region predetection algorithm.
Value Type | Value Range | Default Value |
---|---|---|
string | A string value representing one or more colour sets. | ”” |
Remarks
ForegroundColour
, BackgroundColour
, Tolerance
].ForegroundColour
and BackgroundColour
are the Hue values in the HSV colour space for defining the foreground and background colours of the regions you want to predetect. The value -1 means black, gray, white.Tolerance
is the allowable deviation of the Hue value defined by ForegroundColour
.ForegroundColour
, BackgroundColour
: [-1,360]Tolerance
: [0, 360]Specifies a set (or multiple sets) of height range for filtering the predetected region.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
string | A string value representing height range sets. | ”” | RPM_GENERAL_HSV_CONTRAST |
Remarks
MinHeight
, MaxHeight
].MinHeight
, MaxHeight
: [1, 0x7fffffff]Sets the minimum image dimension (in pixels) to enable region pre-detection.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
int | [16384, 0x7fffffff] | 262144 | RPM_GENERAL_HSV_CONTRAST RPM_GENERAL_RGB_CONTRAST RPM_GENERAL_GRAY_CONTRAST |
Remarks
The library will enable the region pre-detection feature only when the image dimension is larger than the given value.
Sets the barcode regions relative to the predetected region.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
string | A string value representing one or more regions. | ”” | RPM_GENERAL_HSV_CONTRAST |
Remarks
Left
, Top
, Right
, Bottom
, Index
]. If you want to define multiple regions, you can use a “”;”” to separate them. If there is no region defined, the library will consider the predetected regions as barcode regions.Left
, Top
, Right
, Bottom
are four percentage values relative to top-left corner of the predetected region.Index
means the index of a specific colour set in ForeAndBackgroundColours
which the current region is applied to. If the value of index
is set to -1, the current region will be applied to all colour sets in ForeAndBackgroundColours
.Left
, Top
, Right
, Bottom
: [-10000,10000]Index
: [-1, 0x7fffffff]Sets the sensitivity used for region predetection algorithm.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
int | [1, 9] | 1 | RPM_GENERAL_HSV_CONTRAST RPM_GENERAL_RGB_CONTRAST RPM_GENERAL_GRAY_CONTRAST |
Remarks
A larger value means the library will take more effort to detect regions.
Sets the spatial index block size used for region predetection algorithm.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
int | [1, 32] | 5 | RPM_GENERAL_HSV_CONTRAST RPM_GENERAL_RGB_CONTRAST RPM_GENERAL_GRAY_CONTRAST |
Remarks
The block size used for region predetection would be 2 to the power of N. The allowed values of SpatialIndexBlockSize is the power number (N=1,2,3…).
Specifies a set (or multiple sets) of width range for filtering the predetected region.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
string | A string value representing width range sets. | ”” | RPM_GENERAL_HSV_CONTRAST |
Remarks
MinWidth
, MaxWidth
].MinWidth
, MaxWidth
: [1, 0x7fffffff]Sets the file name of the library to load dynamically.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
string | A string value representing file name. | ”” | All modes |
Remarks
The library must be in the same place with Dynamsoft Barcode Reader Library.
Sets the parameters passed to the library to load dynamically.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
string | A string value representing parameters. | ”” | All modes |
version 8.1.2