1 Star 0 Fork 0

Nuyoah / scaning_block

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
videoDetectionCode.py 918 Bytes
一键复制 编辑 原始数据 按行查看 历史
Nuyoah 提交于 2024-03-22 18:10 . feat:视频流识别
import fastdeploy as fd
import fastdeploy.vision as vision
import cv2
import os
import random
import numpy as np
import math
from pyzbar.pyzbar import decode
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
# Convert the image to grayscale
gray_image = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Use Pyzbar library to detect and decode barcodes
barcodes = decode(gray_image)
print(barcodes)
# Loop through detected barcodes and print their data
for barcode in barcodes:
barcode_data = barcode.data.decode("utf-8")
print("Barcode Data:", barcode_data)
# Draw a rectangle around the barcode
x, y, w, h = barcode.rect
cv2.rectangle(gray_image, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2.imshow('Object Detection', gray_image)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xiaoshengdi/scaning_block.git
git@gitee.com:xiaoshengdi/scaning_block.git
xiaoshengdi
scaning_block
scaning_block
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891