Skip to content

Commit 93196f8

Browse files
authored
Merge pull request #758 from dynamsoft-docs/preview
update to internal commit bd7a9651
2 parents 2f09ef5 + c4a3489 commit 93196f8

19 files changed

+196
-2
lines changed

programming/features/barcode-formats-and-count.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,23 @@ You can configure the parameter in two different ways, depending on your require
1919
* Configure barcode format via `SimplifiedCaptureVisionSettings`.
2020

2121
<div class="sample-code-prefix template2"></div>
22+
>- JavaScript
2223
>- C++
2324
>- Android
2425
>- Objective-C
2526
>- Swift
2627
>
2728
>
29+
```javascript
30+
// Obtain current runtime settings of `router` instance. Here we use `ReadSingleBarcode` as an example. You can change it to your own template name or the name of other preset template.
31+
let settings = await router.getSimplifiedSettings("ReadSingleBarcode");
32+
// Specify the barcode formats by enumeration values.
33+
// Use "|" to enable multiple barcode formats at one time.
34+
settings.barcodeSettings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE | Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE;
35+
// Update the settings to a specific template.
36+
await router.updateSettings("ReadSingleBarcode", settings);
37+
```
38+
>
2839
```c++
2940
char szErrorMsg[256] = {0};
3041
// Obtain current runtime settings of `CCaptureVisionRouter` instance.
@@ -102,12 +113,19 @@ do{
102113
* apply settings by calling method `InitSettingsFromFile`
103114

104115
<div class="sample-code-prefix template2"></div>
116+
>- JavaScript
105117
>- C++
106118
>- Android
107119
>- Objective-C
108120
>- Swift
109121
>
110122
>
123+
```javascript
124+
// `router` is an instance of `CaptureVisionRouter`.
125+
// In the JS edition, the method name we use for initialization is different.
126+
router.initSettings("PATH-TO-YOUR-SETTING")
127+
```
128+
>
111129
```c++
112130
char szErrorMsg[256] = {0};
113131
CCaptureVisionRouter* cvr = new CCaptureVisionRouter;
@@ -155,12 +173,21 @@ You can configure the parameter in two different ways, depending on your require
155173
* Configure expected barcode count via `SimplifiedCaptureVisionSettings`.
156174

157175
<div class="sample-code-prefix template2"></div>
176+
>- JavaScript
158177
>- C++
159178
>- Android
160179
>- Objective-C
161180
>- Swift
162181
>
163182
>
183+
```javascript
184+
// Obtain current runtime settings of `router` instance. Here we use `ReadSingleBarcode` as an example. You can change it to your own template name or the name of other preset template.
185+
let settings = await router.getSimplifiedSettings("ReadSingleBarcode");
186+
// Specify the expected barcode count.
187+
settings.barcodeSettings.expectedBarcodesCount = 1;
188+
// Update the settings.
189+
await router.updateSettings("ReadSingleBarcode", settings);
190+
```
164191
>
165192
```c++
166193
char szErrorMsg[256] = {0};
@@ -237,12 +264,19 @@ do{
237264
* apply settings by calling method `InitSettingsFromFile`
238265

239266
<div class="sample-code-prefix template2"></div>
267+
>- JavaScript
240268
>- C++
241269
>- Android
242270
>- Objective-C
243271
>- Swift
244272
>
245273
>
274+
```javascript
275+
// `router` is an instance of `CaptureVisionRouter`.
276+
// In the JS edition, the method name we use for initialization is different.
277+
router.initSettings("PATH-TO-YOUR-SETTING")
278+
```
279+
>
246280
```c++
247281
char szErrorMsg[256] = {0};
248282
CCaptureVisionRouter* cvr = new CCaptureVisionRouter;

programming/features/barcode-scan-region.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,22 @@ Dynamsoft Barcode Reader (DBR) will locate the code region and decode the entire
1717
* Configure region via `SimplifiedCaptureVisionSettings`
1818

1919
<div class="sample-code-prefix template2"></div>
20+
>- JavaScript
2021
>- C++
2122
>
2223
>
24+
```javascript
25+
// Obtain current runtime settings of `router` instance. Here we use `ReadSingleBarcode` as an example. You can change it to your own template name or the name of other preset template.
26+
let settings = await router.getSimplifiedSettings("ReadSingleBarcode");
27+
// Specify the ROI
28+
settings.roi.points[0] = {x:10, y:10};
29+
settings.roi.points[1] = {x:90, y:10};
30+
settings.roi.points[2] = {x:90, y:90};
31+
settings.roi.points[3] = {x:10, y:90};
32+
// Update the settings to a specific template.
33+
await router.updateSettings("ReadSingleBarcode", settings);
34+
```
35+
>
2336
```c++
2437
char szErrorMsg[256] = {0};
2538
// Obtain current runtime settings of `CCaptureVisionRouter` instance.

programming/features/control-terminate-phase.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,19 @@ You can configure the parameter in two different ways, depending on your require
6565
* Configure timeout via `SimplifiedCaptureVisionSettings`.
6666

6767
<div class="sample-code-prefix template2"></div>
68+
>- JavaScript
6869
>- C++
6970
>
7071
>
72+
```javascript
73+
// Obtain current runtime settings of `router` instance. Here we use `ReadSingleBarcode` as an example. You can change it to your own template name or the name of other preset template.
74+
let settings = await router.getSimplifiedSettings("ReadSingleBarcode");
75+
// Specify the timeout
76+
settings.timeout = 1000;
77+
// Update the settings to a specific template.
78+
await router.updateSettings("ReadSingleBarcode", settings);
79+
```
80+
>
7181
```c++
7282
char szErrorMsg[256] = {0};
7383
// Obtain current runtime settings of `CCaptureVisionRouter` instance.

programming/features/filter-and-sort.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,19 @@ Below is an example illustrating how to filter out QR Code results with confiden
6767
* apply settings by calling method `InitSettingsFromFile`
6868

6969
<div class="sample-code-prefix template2"></div>
70+
>- JavaScript
7071
>- C++
7172
>- Android
7273
>- Objective-C
7374
>- Swift
7475
>
7576
>
77+
```javascript
78+
// `router` is an instance of `CaptureVisionRouter`.
79+
// In the JS edition, the method name we use for initialization is different.
80+
router.initSettings("PATH-TO-YOUR-SETTING")
81+
```
82+
>
7683
```c++
7784
char szErrorMsg[256] = {0};
7885
CCaptureVisionRouter* cvr = new CCaptureVisionRouter;

programming/features/get-barcode-location.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,25 @@ A barcode result is returned as a `BarcodeResultItem` which provides a method `G
1919
The following code snippet shows how to get the coordinates of the barcode:
2020

2121
<div class="sample-code-prefix template2"></div>
22+
>- JavaScript
2223
>- C++
2324
>- Android
2425
>- Objective-C
2526
>- Swift
2627
>
2728
>
29+
```javascript
30+
const result = await cvRouter.capture(file, "ReadSingleBarcode");
31+
for (let item of result.items) {
32+
if (item.type === Dynamsoft.Core.EnumCapturedResultItemType.CRIT_BARCODE) {
33+
console.log("Point 0: " + JSON.stringify(item.location.points[0]));
34+
console.log("Point 1: " + JSON.stringify(item.location.points[1]));
35+
console.log("Point 2: " + JSON.stringify(item.location.points[2]));
36+
console.log("Point 3: " + JSON.stringify(item.location.points[3]));
37+
}
38+
}
39+
```
40+
>
2841
```c++
2942
CCaptureVisionRouter* cvr = new CCaptureVisionRouter;
3043
CCapturedResult* result = cvr->Capture("IMAGE-FILE-PATH", CPresetTemplate::PT_READ_BARCODES);

programming/features/get-confidence-rotation.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,23 @@ The following illustrations will show how the angle is calculated for different
4040
The following code snippet shows how to get the confidence and rotation angle of the barcode result:
4141

4242
<div class="sample-code-prefix template2"></div>
43+
>- JavaScript
4344
>- C++
4445
>- Android
4546
>- Objective-C
4647
>- Swift
4748
>
4849
>
50+
```javascript
51+
const result = await cvRouter.capture(file, "ReadSingleBarcode");
52+
for (let item of result.items) {
53+
if (item.type === Dynamsoft.Core.EnumCapturedResultItemType.CRIT_BARCODE) {
54+
console.log("confidence: " + item.confidence);
55+
console.log("angle: " + item.angle);
56+
}
57+
}
58+
```
59+
>
4960
```c++
5061
CCaptureVisionRouter* cvr = new CCaptureVisionRouter;
5162
CCapturedResult* result = cvr->Capture("IMAGE-FILE-PATH", CPresetTemplate::PT_READ_BARCODES);

programming/features/get-detailed-info.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,23 @@ Here we take QR Code as example and show how to get the version and model of a Q
3838
## Code Snippet for Getting Detailed Barcode Information
3939

4040
<div class="sample-code-prefix template2"></div>
41+
>- JavaScript
4142
>- C++
4243
>- Android
4344
>- Objective-C
4445
>- Swift
4546
>
4647
>
48+
```javascript
49+
const result = await cvRouter.capture(file, "ReadSingleBarcode");
50+
for (let item of result.items) {
51+
if (item.type === Dynamsoft.Core.EnumCapturedResultItemType.CRIT_BARCODE) {
52+
console.log("QR_version: " + item.details.version);
53+
console.log("QR_model: " + item.details.model);
54+
}
55+
}
56+
```
57+
>
4758
```c++
4859
CCaptureVisionRouter* cvr = new CCaptureVisionRouter;
4960
CCapturedResult* result = cvr->Capture("IMAGE-FILE-PATH", CPresetTemplate::PT_READ_BARCODES);

programming/features/preprocess-images.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,19 @@ Below is an example illustrating how to configure the parameter `GrayscaleEnhanc
110110
* apply settings by calling method `InitSettingsFromFile`
111111

112112
<div class="sample-code-prefix template2"></div>
113+
>- JavaScript
113114
>- C++
114115
>- Android
115116
>- Objective-C
116117
>- Swift
117118
>
118119
>
120+
```javascript
121+
// `router` is an instance of `CaptureVisionRouter`.
122+
// In the JS edition, the method name we use for initialization is different.
123+
router.initSettings("PATH-TO-YOUR-SETTING")
124+
```
125+
>
119126
```c++
120127
char szErrorMsg[256] = {0};
121128
CCaptureVisionRouter* cvr = new CCaptureVisionRouter;

programming/features/read-a-large-image.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,19 @@ Below is an example illustrating how to configure the parameter `ScaleDownThresh
6565
* apply settings by calling method `InitSettingsFromFile`
6666

6767
<div class="sample-code-prefix template2"></div>
68+
>- JavaScript
6869
>- C++
6970
>- Android
7071
>- Objective-C
7172
>- Swift
7273
>
7374
>
75+
```javascript
76+
// `router` is an instance of `CaptureVisionRouter`.
77+
// In the JS edition, the method name we use for initialization is different.
78+
router.initSettings("PATH-TO-YOUR-SETTING")
79+
```
80+
>
7481
```c++
7582
char szErrorMsg[256] = {0};
7683
CCaptureVisionRouter* cvr = new CCaptureVisionRouter;

programming/features/read-barcodes-with-imbalanced-colour.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,19 @@ Below is an example illustrating how to configure the parameter `ColourConversio
9999
* apply settings by calling method `InitSettingsFromFile`
100100

101101
<div class="sample-code-prefix template2"></div>
102+
>- JavaScript
102103
>- C++
103104
>- Android
104105
>- Objective-C
105106
>- Swift
106107
>
107108
>
109+
```javascript
110+
// `router` is an instance of `CaptureVisionRouter`.
111+
// In the JS edition, the method name we use for initialization is different.
112+
router.initSettings("PATH-TO-YOUR-SETTING")
113+
```
114+
>
108115
```c++
109116
char szErrorMsg[256] = {0};
110117
CCaptureVisionRouter* cvr = new CCaptureVisionRouter;

0 commit comments

Comments
 (0)