Skip to content

Commit a6a5859

Browse files
docs: Updated guide/index.md to remove the part to set ROI in SimplifiedSettings, promote only setScanRegion with DCE [Reason: this guide is for starting users]
1 parent 23bf9cf commit a6a5859

File tree

1 file changed

+26
-18
lines changed
  • programming/javascript/user-guide

1 file changed

+26
-18
lines changed

programming/javascript/user-guide/index.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,30 @@ await cvRouter.startCapturing("ReadSingleBarcode");
543543
544544
##### Specify a scan region
545545
546+
We can specify a scan region to allow the SDK to process only part of the image, improving processing speed. The code snippet below demonstrates how to do this using the `cameraEnhancer` image source.
547+
```javascript
548+
cameraEnhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance(cameraView);
549+
cameraEnhancer.setScanRegion({
550+
x: 25,
551+
y: 25,
552+
width: 50,
553+
height: 50,
554+
isMeasuredInPercentage: true,
555+
});
556+
```
557+
558+
*Note*:
559+
560+
1. By configuring the region at the image source, images are cropped before processing, removing the need to adjust any further processing settings.
561+
2. `cameraEnhancer` enhances interactivity by overlaying a mask on the video, clearly marking the scanning region.
562+
563+
*See Also*:
564+
565+
[CameraEnhancer::setScanRegion](https://www.dynamsoft.com/camera-enhancer/docs/web/programming/javascript/api-reference/acquisition.html#setscanregion)
566+
567+
<!-- Since DCE is always used, no need to use this approach
568+
569+
546570
You can use the parameter `roi` (region of interest) together with the parameter `roiMeasuredInPercentage` to configure the SDK to only read a specific region on the image frames. For example, the following code limits the reading in the center 25%( = 50% * 50%) of the image frames:
547571
548572
```javascript
@@ -556,24 +580,8 @@ settings.roi.points = [
556580
];
557581
await cvRouter.updateSettings("ReadSingleBarcode", settings);
558582
await cvRouter.startCapturing("ReadSingleBarcode");
559-
```
560-
561-
While the code above accomplishes the task, a more effective approach is to restrict the scan region directly at the image source, as demonstrated in the following code snippet.
583+
``` -->
562584
563-
> * With the region configured at the image source, the images are cropped right before they are gathered for processing, eliminating the necessity to modify the processing settings further.
564-
> * `cameraEnhancer` elevates interactivity by overlaying a mask on the video, providing a clear delineation of the scanning region.
565-
> * See also: [CameraEnhancer::setScanRegion](https://www.dynamsoft.com/camera-enhancer/docs/web/programming/javascript/api-reference/acquisition.html#setscanregion)
566-
567-
```javascript
568-
cameraEnhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance(cameraView);
569-
cameraEnhancer.setScanRegion({
570-
x: 25,
571-
y: 25,
572-
width: 50,
573-
height: 50,
574-
isMeasuredInPercentage: true,
575-
});
576-
```
577585
578586
<!--
579587
* Specify the maximum time allowed for processing each image
@@ -730,4 +738,4 @@ Now that you have got the SDK integrated, you can choose to move forward in the
730738

731739
1. Learn how to [Use in Framework](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/user-guide/use-in-framework.html)
732740
2. Check out the [Official Samples and Demo](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/samples-demos/index.html?ver=10.2.10)
733-
3. Learn about the [APIs of the SDK](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/index.html?ver=10.2.10)
741+
3. Learn about the [APIs of the SDK](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/index.html?ver=10.2.10)

0 commit comments

Comments
 (0)