【问题标题】:Is there any way to read CODE39 Extended in html code reader?有没有办法在 html 代码阅读器中读取 CODE39 Extended?
【发布时间】:2022-11-07 08:12:08
【问题描述】:

我正在尝试使用 https://github.com/mebjas/html5-qrcode 。 有什么方法可以读取 CODE39 扩展条码,使用这个或其他基于 Web 的代码阅读器? 我想阅读随附的条形码,例如:

【问题讨论】:

标签: javascript barcode


【解决方案1】:

这是在您提供的图像上使用 quaggajs(原始项目)的示例:

// -- commonjs usage --
const Quagga = require('quagga').default;
// -- ES6 usage --
// import Quagga from 'quagga';


Quagga.decodeSingle({
    decoder: {
        readers: ["code_39_reader"] // List of active readers
    },
    numOfWorkers: 0,  // Needs to be 0 when used within node
    locate: true, // try to locate the barcode in the image
    src: 'c:/tmp/tYlHd.jpg' // or 'data:image/jpg;base64,' + data
}, function(result){
    if (result.codeResult) {
        console.log("result", result.codeResult.code);
    } else {
        console.log("not detected");
    }
});

控制台输出为:

result PAUT-953MAGENTA

上面的用法是针对 node-js 的。在浏览器中使用时,注释掉numOfWorkers:0 这一行。

【讨论】:

    【解决方案2】:

    你在哪个平台上测试这个?

    你有没有试过这个配置:

    let html5QrcodeScanner = new Html5QrcodeScanner(
        "reader", 
        { 
            fps: 10,
            qrbox: {width: 250, height: 250},
            useBarCodeDetectorIfSupported: true,
            rememberLastUsedCamera: true,
            aspectRatio: 4/3,
            showTorchButtonIfSupported: true
        });
    

    如果这不起作用,您能否验证这个是否适合您:https://github.com/mebjas/html5-qrcode/tree/performance/minified

    如果仍然无法正常工作,请在https://github.com/mebjas/html5-qrcode/issues/new/choose 提交错误并提供更多信息,我将调查该问题。

    (作者在这里)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-10
      • 1970-01-01
      • 2016-12-15
      • 2022-11-10
      相关资源
      最近更新 更多