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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM