Created
July 27, 2020 00:54
-
-
Save yushulx/f65628100f17b3709ef30cb582ad498c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var barcodereader = null; | |
(async()=>{ | |
barcodereader = await Dynamsoft.BarcodeReader.createInstance(); | |
await barcodereader.updateRuntimeSettings('speed'); | |
let settings = await barcodereader.getRuntimeSettings(); | |
settings.deblurLevel = 0; | |
barcodereader.updateRuntimeSettings(settings); | |
})(); | |
let canvas2d = document.createElement('canvas'); | |
canvas2d.width = width; | |
canvas2d.height = height; | |
var ctx2d = canvas2d.getContext('2d'); | |
ctx2d.drawImage(videoElement, 0, 0, width, height); | |
buffer = ctx2d.getImageData(0, 0, width, height).data; | |
if (barcodereader){ | |
barcodereader | |
.decodeBuffer( | |
buffer, | |
width, | |
height, | |
width * 4, | |
Dynamsoft.EnumImagePixelFormat.IPF_ARGB_8888 | |
) | |
.then((results) => { | |
showResults(results); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment