-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdynamsoft-label-recognizer-Dev-version-sample.html
40 lines (38 loc) · 1.83 KB
/
dynamsoft-label-recognizer-Dev-version-sample.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>dynamsoft-label-recognizer-Dev-version-sample</title>
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-camera-enhancer@2.0.3/dist/dce.js"></script>
<script src="https://cdn.jsdelivr.net/npm/keillion-dynamsoft-label-recognizer@0.20211123171208.0/dist/dlr.js" data-license="t0068MgAAAKUZULwM1SshTkeSYEV5LPo0cnYXkSYBlpGkb0XcP1NTLvP+//NMWCbQfuyxGn1hbLfqF/bV7FuoMzNPJljQqW0="></script>
</head>
<body>
<button id="btn-openRecognizer">open recognizer</button><br>
<script>
let recognizer = null, pRecognizer = null;
let cameraEnhancer = null, pCameraEnhancer = null;
async function openRecognizer() {
cameraEnhancer = await (pCameraEnhancer = pCameraEnhancer || Dynamsoft.DCE.CameraEnhancer.createInstance());
await cameraEnhancer.setUIElement(Dynamsoft.DLR.LabelRecognizer.defaultUIElementURL);
recognizer = await (pRecognizer = pRecognizer || Dynamsoft.DLR.LabelRecognizer.createInstance({
runtimeSettings: "video-vin"
}));
recognizer.cameraEnhancer = cameraEnhancer;
await recognizer.startScanning(true);
recognizer.onFrameRead = async results => {
for (let result of results) {
for (let lineResult of result.lineResults) {
console.log(lineResult.text);
}
}
}
recognizer.onUniqueRead = txt => alert("onUniqueRead: "+txt);
}
document.getElementById('btn-openRecognizer').addEventListener("click", function(){
openRecognizer();
});
</script>
</body>
</html>