opencv视频流目标检测

1.采用opencv深度学习模块调用mobilenet_ssd模型进行目标检测,模型可以直接移植到移动端使用,毕竟模型不是很重,直接放线下测试代码:以供参考

import numpy as np
import cv2

deploy_prototxt = 'MobileNet-SSD/deploy.prototxt'
model = 'MobileNet-SSD/mobilenet_iter_73000.caffemodel'
confidence_default = 0.2

CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
           "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
           "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
           "sofa", "train", "tvmonitor"]
COLORS = np.random.uniform(0, 255, size=(len(CLASSES), 3))

print("[info] loading model...")
net = cv2.dnn.readNetFromCaffe(deploy_prototxt, model)

# 打开摄像头
camera = cv2.VideoCapture('video/2c2b6d119306711be3bd7e52f7f27ca7.mp4')
print(camera)
# cv2.namedWindow('Dynamic')
width = int(camera.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(camera.get(cv2.CAP_PROP_FRAME_HEIGHT))
print(height)
fps = camera.get(cv2.CAP_PROP_FPS)
fourcc = cv2.VideoWriter_fo
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值