-
Notifications
You must be signed in to change notification settings - Fork 0
/
dlr.html
62 lines (59 loc) · 2.44 KB
/
dlr.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<body>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/core.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/license.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/utility.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dlr.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cvr.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dce.js"></script>
<div id="cameraViewContainer" style="width: 100%; height: 60vh"></div>
<textarea
id="results"
style="width: 100%; min-height: 10vh; font-size: 3vmin; overflow: auto"
disabled
></textarea>
<script>
Dynamsoft.License.LicenseManager.initLicense(
"DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9"
);
(async () => {
router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
let view = await Dynamsoft.DCE.CameraView.createInstance();
cameraEnhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance(
view
);
document
.querySelector("#cameraViewContainer")
.append(view.getUIElement());
router.setInput(cameraEnhancer);
const resultsContainer = document.querySelector("#results");
router.addResultReceiver({
onRecognizedTextLinesReceived: (result) => {
if (result.textLineResultItems.length > 0) {
resultsContainer.textContent = "";
for (let item of result.textLineResultItems) {
resultsContainer.textContent += `${item.text}\n`;
}
}
},
});
let filter = new Dynamsoft.Utility.MultiFrameResultCrossFilter();
filter.enableResultCrossVerification(
Dynamsoft.Core.EnumCapturedResultItemType.CRIT_BARCODE,
true
);
filter.enableResultDeduplication(
Dynamsoft.Core.EnumCapturedResultItemType.CRIT_BARCODE,
true
);
await router.addResultFilter(filter);
await router.initSettings(
"https://tst.dynamsoft.com/public/samples/dcvTemplates/readPassportMRZ.json"
);
await cameraEnhancer.open();
await router.startCapturing("passport-mrz");
})();
</script>
</body>
</html>