当前位置: 首页 > 工具软件 > QuaggaJS > 使用案例 >

quaggaJS 识别条形码

朱渝
2023-12-01
<!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>
 
 
 
发现个问题就是:识别的准确率还是有点问题?
 类似资料: