0

标题很不言自明。我被迫评估 QuaggaJS 的工作,我遇到了许多问题,其中主要是它将相机视图呈现为一条细长的条带,而不是我要求的 640x480 块。

    Quagga.init({
        inputStream : {
            name : "Live",
            type : "LiveStream",
            target: document.querySelector('#scanblock'),
            constraints: {
                width: 640,
                height: 480,
                aspectRatio: {min: 1, max: 100},
                facingMode: "environment" // or user
            }
        },
        locate: false,
        locator: {
            patchSize: "medium",
            halfSample: true
        },
        numOfWorkers: 2,
        frequency: 10,
        decoder : {
            readers : ["code_128_reader"]
        }
    }, function(err) {
        if (err) {
            console.log(err);
            return
        }
        console.log("Initialization finished. Ready to start");
        Quagga.start();
    });

    Quagga.onDetected(function (result) {
        var last_code = result.codeResult.code;
        alert(last_code);
        console.log(last_code);
        Quagga.stop();
    });

在此处输入图像描述

4

0 回答 0