2020年4月26日 星期日
2020年4月12日 星期日
barcode detection and decoder -- pyzbar
前面提到如何安裝 pyzbar , 使用上也很簡單
sample code 如下
from pyzbar import pyzbar # 這邊要記住我 import 的方式
import cv2
image = cv2.imread("images.png")
barcodes = pyzbar.decode(image)
先用 cv2 讀出要辨識的 image
再用 pyzbar.decode 讀出 照片中的 barcodes 有哪些
barcodes 內會把照片所有辨識出的 barcode , 內容與位置都會用 dict 格式純在 list
內容如下
也就是說每個 barcode , 都會有對應的 data ( qrcode 的內容)
type :(qrcode 的 type)
rect ( qrcode 的位置 x,y, w,h)
polygon 折式qrcode 四點的位置)
sample code 如下
from pyzbar import pyzbar # 這邊要記住我 import 的方式
import cv2
image = cv2.imread("images.png")
barcodes = pyzbar.decode(image)
先用 cv2 讀出要辨識的 image
再用 pyzbar.decode 讀出 照片中的 barcodes 有哪些
barcodes 內會把照片所有辨識出的 barcode , 內容與位置都會用 dict 格式純在 list
內容如下
也就是說每個 barcode , 都會有對應的 data ( qrcode 的內容)
type :(qrcode 的 type)
rect ( qrcode 的位置 x,y, w,h)
polygon 折式qrcode 四點的位置)
[
Decoded(
data=b'Foramenifera', type='CODE128',
rect=Rect(left=37, top=550, width=324, height=76),
polygon=[
Point(x=37, y=551), Point(x=37, y=625), Point(x=361, y=626),
Point(x=361, y=550)
]
)
Decoded(
data=b'Rana temporaria', type='CODE128',
rect=Rect(left=4, top=0, width=390, height=76),
polygon=[
Point(x=4, y=1), Point(x=4, y=75), Point(x=394, y=76),
Point(x=394, y=0)
]
)
]
python barcode detection and decoder -- pybar 安裝
用 python 便是一些基礎的東西 越來越簡單, 原本有個專案要辨識 barcode , 本想自己硬幹
但發現有現成 performance 也很好的 Library pybar
可以做 barcode detection 與 decoder ...
但 pybar 不能直接 install , 需要現下載 zbar , windows 已經包含在 wheel 內不需再按裝, 但需要有 Visual C++ Redistributable Packages for Visual Studio 2013.
Mac 與 Linux follow 下面方式下窄即可 (出處:https://pypi.org/project/pyzbar/)
但發現有現成 performance 也很好的 Library pybar
可以做 barcode detection 與 decoder ...
但 pybar 不能直接 install , 需要現下載 zbar , windows 已經包含在 wheel 內不需再按裝, 但需要有 Visual C++ Redistributable Packages for Visual Studio 2013.
Mac 與 Linux follow 下面方式下窄即可 (出處:https://pypi.org/project/pyzbar/)
Mac OS X:
brew install zbar
Linux:
sudo apt-get install libzbar0
Install this Python wrapper; use the second form to install dependencies of the command-line scripts:
pip install pyzbar
訂閱:
意見 (Atom)
Bloomberg Markets Wrap 2025-08-15: 股市因美國數據下漲,川普與普丁會議獲關注
Bloomberg Markets Wrap 2025-08-15: 股市因美國數據下滑,川普與普丁會談受關注 發佈日期:2025-08-15 本篇文章翻譯與整理自 Bloomberg Markets Wrap(經 SWI swissin fo.ch 彙整),該報111導回顧了...
-
imagezmq 套件 讓人輕易的可以將遠端的影像串流傳送到server 上 目前有一個專案 , 需要將 Tx2 上處理過的影像傳到 座位上以方便監控 使用 imagezmq 開發讓事情變得很間單 架構如下 Tx2 (imagezmq client) --...
-
讀取 IP Cameras 的方法非常簡單 可以直接使用 Open CV package import cv2 # ip camera 的擷取路徑 URL = "rtsp://admin:admin@192.168.1.1/1" # 建立 V...
-
上一篇有提到如果有多個按鈕, 他要觸發相識的東西有需要一個個寫對應的訊號 跟 槽嗎 上一篇我們設計了 81 個按鈕, 所以會產生81 個訊號, 如果對應的結果是完全相同當然只要寫一個槽就好了 但如果對應的結果只是相似, 但不完全要同要如何處理呢? 我們先來demo 要如...
