折騰前端條形碼(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...

相關文章
相關標籤/搜索