update runtime settings to set region defination
bmabir17 opened this issue · 4 comments
bmabir17 commented
For a particular reason i have to define the region defination as the code is defined in left most part of the image. tried the following code but the updateRuntimeSettings becomes null
scanner = scanner || await Dynamsoft.DBR.BarcodeScanner.createInstance();
let scanner_settings = await scanner.getRuntimeSettings();
console.log(scanner_settings);
scanner_settings.region.regionLeft=25;
await reader.updateRuntimeSettings(scanner_settings);
I tried the python sdk where i needed to set the runtime settings as follows
"RegionDefinition": {
"BarcodeFormatIds": [
"BF_ALL"
],
"BarcodeFormatIds_2": [
"BF2_POSTALCODE",
"BF2_DOTCODE"
],
"Bottom": 100,
"ExpectedBarcodesCount": 0,
"FormatSpecificationNameArray": null,
"Left": 25,
"MeasuredByPercentage": 1,
"Name": "default",
"Right": 32,
"Top": 0
},
Now i want the similar settings to be set on the js sdk
Keillion commented
scanner_settings.region.regionLeft = 25;
scanner_settings.region.regionTop = 0;
scanner_settings.region.regionRight = 32;
scanner_settings.region.regionBottom = 100;
scanner_settings.region.regionMeasuredByPercentage = 1;
await reader.updateRuntimeSettings(scanner_settings);
Keillion commented
@bmabir17
I am a little puzzled why it was a scanner
in the beginning, and then it became a reader
.
bmabir17 commented
sorry that was my mistake 😅
bmabir17 commented
This worked
scanner = scanner || await Dynamsoft.DBR.BarcodeScanner.createInstance();
let scanner_settings = await scanner.getRuntimeSettings();
console.log(scanner_settings);
scanner_settings.region.regionLeft = 25;
scanner_settings.region.regionTop = 0;
scanner_settings.region.regionRight = 32;
scanner_settings.region.regionBottom = 100;
scanner_settings.region.regionMeasuredByPercentage = 1;
await scanner.updateRuntimeSettings(scanner_settings);