RegionPredetectionModes
Parameter RegionPredetectionModes
controls how to find a region of interest (ROI) within the image or frame.
Example
{
"RegionPredetectionModes": [
{
"Mode": "RPM_GENERAL_GRAY_CONTRAST",
"Sensitivity": 5
},
{
"Mode": "RPM_GENERAL_RGB_CONTRAST",
"Sensitivity": 5
},
{
"Mode": "RPM_GENERAL_HSV_CONTRAST",
"ForeAndBackgroundColours":[20,170,10],
"WidthRange": "[100, 200]"
}
]
}
Parameter Summary
Mode Arguments
Parameter RegionPredetectionModes
consist of a group of region predetection mode objects. Each region predetection mode object includes a candidate mode and a series of mode arguments. The mode arguments of the region predetection mode object is shown as follow:
Mode Argument Name | Mode Argument Summary |
---|---|
Mode (Required) |
Description Any one in Candidate Mode List as string |
Type String |
|
Candidate Mode List RPM_SKIP RPM_AUTO RPM_GENERAL RPM_GENERAL_RGB_CONTRAST RPM_GENERAL_GRAY_CONTRAST RPM_GENERAL_HSV_CONTRAST |
|
AspectRatioRange (Optional) |
Description Specifies one or multiple sets of aspect ratio ranges as a string for filtering the predetected region. Aspect Ratio = BoundingRectHeight/BoundingRectWidth * 100 |
Type String |
|
Substruct Define one range: "[MinAspectRatio, MaxAspectRatio]" Define multiple ranges: "[MinAspectRatio, MaxAspectRatio];[MinAspectRatio, MaxAspectRatio];..." |
|
Range MinAspectRatio: [0,10000] MaxAspectRatio: [0,10000] |
|
Valid For RPM_GENERAL_HSV_CONTRAST |
|
FindAccurateBoundary (Optional) |
Description Sets whether to enable finding accurate boundary: 0: disable. 1: enable. |
Type int |
|
Range [0,1] |
|
Valid For RPM_GENERAL_HSV_CONTRAST RPM_GENERAL_RGB_CONTRAST RPM_GENERAL_GRAY_CONTRAST |
|
ForeAndBackgroundColours (Required by RPM_GENERAL_HSV_CONTRAST ) |
Description Specifies a set (or multiple sets) of the foreground and background colours used for region predetection algorithm based on HSV colour space: |
Type String |
|
Substruct Define one range: "[ForegroundColour,BackgroundColour,Tolerance]" Define multiple ranges: "[ForegroundColour,BackgroundColour,Tolerance];[ForegroundColour,BackgroundColour,Tolerance];..." |
|
Range ForegroundColour: [-1,360] BackgroundColour: [-1,360] Tolerance: [0, 360] |
|
Valid For RPM_GENERAL_HSV_CONTRAST |
|
HeightRange (Optional) |
Description Specifies a set (or multiple sets) of height range for filtering the predetected region. The height is measured by the height of the bounding rect of the predetected region. |
Type String |
|
Substruct Define one range: "[MinHeight, MaxHeight]" Define multiple ranges: "[MinHeight, MaxHeight];[MinHeight, MaxHeight];..." |
|
Range MinHeight: [1, 0x7fffffff] MaxHeight: [1, 0x7fffffff] |
|
Valid For RPM_GENERAL_HSV_CONTRAST |
|
WidthRange (Optional) |
Description Specifies a set (or multiple sets) of width range for filtering the predetected region. The width is measured by the width of the bounding rect of the predetected region. |
Type String |
|
Substruct Define one range: "[MinWidth, MaxWidth]" Define multiple ranges: "[MinWidth, MaxWidth];[MinWidth, MaxWidth];..." |
|
Range A string value representing height range sets. |
|
Valid For RPM_GENERAL_HSV_CONTRAST |
|
MinImageDimension (Optional) |
Description Sets the minimum image dimension (in pixels) to enable region pre-detection. The library will enable the region pre-detection feature only when the image dimension is larger than the given value. |
Type int |
|
Range [16384, 0x7fffffff] |
|
Valid For RPM_GENERAL_HSV_CONTRAST RPM_GENERAL_RGB_CONTRAST RPM_GENERAL_GRAY_CONTRAST |
|
RelativeRegions (Optional) |
Description Sets the barcode regions relative to the pre-detected region. |
Type String |
|
Substruct Define one region: "[Left,Top,Right,Bottom,Index]" Define multiple region: "[Left,Top,Right,Bottom,Index];[Left,Top,Right,Bottom,Index];..." |
|
Range Left, Top, Right, Bottom: [-10000,10000] Index: [-1,0x7fffffff] |
|
Valid For RPM_GENERAL_HSV_CONTRAST |
|
Remarks Parameters Left, Top, Right, Bottom are measured in percentage. Parameter Index points to a specific colour that set in ForeAndBackgroundColours. Set it to -1 to apply the current RelativeRegion to all ForeAndBackgroundColours. |
|
Sensitivity (Optional) |
Description Sets the sensitivity used for region predetection algorithm, a larger value means the library will take more effort to detect regions. |
Type int |
|
Range [1,9] |
|
Valid For RPM_GENERAL_HSV_CONTRAST RPM_GENERAL_RGB_CONTRAST RPM_GENERAL_GRAY_CONTRAST |
|
SpatialIndexBlockSize (Optional) |
Description Sets the spatial index block size used for region predetection algorithm. 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…). |
Type int |
|
Range [1, 32] |
|
Default Value 5 |
|
Valid For RPM_GENERAL_HSV_CONTRAST RPM_GENERAL_RGB_CONTRAST RPM_GENERAL_GRAY_CONTRAST |
|
LibraryFileName (Optional) |
Description Sets the file name of the library to load dynamically. |
Type String |
|
Range A string value representing file name. |
|
Default Value "" |
|
Valid For All modes. |
|
LibraryParameters (Optional) |
Description The library must be in the same place with Dynamsoft Barcode Reader Library. |
Type String |
|
Range A string value representing parameters. |
|
Default Value "" |
|
Valid For All modes. |
Default Setting
The default settings of RegionPredetectionModes is:
{
"RegionPredetectionModes" :
[
{
"AspectRatioRange" : "[]",
"FindAccurateBoundary" : 0,
"ForeAndBackgroundColours" : "[]",
"HeightRange" : "[]",
"ImageParameterName" : "",
"MeasuredByPercentage" : 1,
"MinImageDimension" : 262144,
"Mode" : "RPM_GENERAL",
"RelativeRegions" : "[]",
"Sensitivity" : 1,
"SpatialIndexBlockSize" : 5,
"WidthRange" : "[]"
}
],
}
Candidate Modes Introduction
RPM_SKIP
Skip region pre-detection process.
RPM_AUTO
Lets the library choose a mode automatically.
RPM_GENERAL
Takes the whole image as a region. This mode has the following arguments for further customizing.
Available Mode Arguments:
- LibraryFileName
- LibraryParameters
RPM_GENERAL_RGB_CONTRAST
Detects region using the general algorithm based on RGB colour contrast. This mode has the following arguments for further customizing.
Available Mode Arguments:
- MinImageDimension
- Sensitivity
- SpatialIndexBlockSize
- LibraryFileName
- LibraryParameters
RPM_GENERAL_GRAY_CONTRAST
Detects region using the general algorithm based on gray contrast. This mode has the following arguments for further customizing.
Available Mode Arguments:
- MinImageDimension
- Sensitivity
- SpatialIndexBlockSize
- LibraryFileName
- LibraryParameters
RPM_GENERAL_HSV_CONTRAST
Detects region using the general algorithm based on HSV colour contrast. This mode has the following arguments for further customizing.
Available Mode Arguments:
- AspectRatioRange
- FindAccurateBoundary
- ForeAndBackgroundColours
- HeightRange
- WidthRange
- RelativeBarcodeRegions
- MinImageDimension
- Sensitivity
- SpatialIndexBlockSize
- LibraryFileName
- LibraryParameters