折腾前端条形码(Barcode)扫描识别, 笔记

barcode

@zxing/library 方案

本地勉强把 Demo 在 React 里面跑通, 但是不好控制开始结束, API 不明确.
实际识别率很低. 我是用手机屏幕放的条形码, 大概也有影响.

https://github.com/aleris/zxi...
https://github.com/zxing-js/l...
https://github.com/zxing-js/l...

Quagga2 方案

  • QuaggaJS

应该是 GitHub 上星星最多的, 但是没有人维护了.

https://serratus.github.io/qu...

  • Quagga2

fork 版本的 QuaggaJS. 一直有更新, 但是没有维护全部的细节, 我在运行 examples 遇到了问题.

初步认为是传入到 Worker 里面执行的代码不完整. 没有把 Quagga 的源码提前传送过去.

有一个用了旧版本的 React 组件的 demo https://github.com/ericblade/...

Barcode Detector 方案

Google 提供的方案, 内置 API, 但是只有 Chrome 支持, 而且手动测试发现需要 80 版本.

https://web.dev/shape-detection/
https://wicg.github.io/shape-...

这个方案不完整, 需要添加 API, 手动处理前面抓取图片的部分, API 已经比较完善的,

https://developers.google.com...
https://medium.com/@immanubha...

zbar + WebAssembly 方案

https://barkeywolf.consulting...
https://github.com/jjhbw/barc...

猜你喜欢

转载自www.cnblogs.com/treeskyer/p/12203107.html