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

@zxing/library 方案(不推荐)

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

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

Quagga2 方案(推荐)

  • QuaggaJS

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

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

  • Quagga2

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

初步认为是传入到 Worker 里面执行的代码不完整. 没有把 Quagga 的源码提早传送过去.
后面做者先把 worker 功能关掉了.. 至少界面不报错了.github

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

本身封装了一个版本
https://github.com/jimengio/q...typescript

Barcode Detector 方案(兼容性问题)

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

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

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

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

整理了一个 Demo
https://github.com/jimengio/j...

zbar + WebAssembly 方案

没有尝试

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

相关文章
相关标签/搜索