<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<script src="vconsole.min.js"></script>
<script src="quagga.js"></script>
</head>
<body>
<div id="canvanCode"></div>
<script>
Quagga.init({
inputStream : {
name : "Live",
type : "LiveStream",
target: document.querySelector('#canvanCode') // Or '#yourElement' (optional)
},
decoder : {
readers : ["ean_reader",'code_39_reader'],
debug: {
drawBoundingBox: false,
showFrequency: false,
drawScanline: false,
showPattern: false
},
multiple: false
}
}, function(err) {
if (err) {
console.log(err);
return
}
console.log("Initialization finished. Ready to start");
Quagga.start();
// Quagga.onProcessed(function(data){
// console.log(data)
// })
Quagga.onDetected(function(data){
console.log(data)
alert(data.codeResult.code)
})
});
</script>
</body>
</html>
发现个问题就是:识别的准确率还是有点问题?