1 Star 0 Fork 1

impecunious/object-detection-masked-rcnn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
video_processing.py 876 Bytes
一键复制 编辑 原始数据 按行查看 历史
pourabk-hexaware 提交于 2019-06-03 14:23 . Added datasets
import cv2
import numpy as np
from visualize_cv2 import model, display_instances, class_names
capture = cv2.VideoCapture('videofile.mp4')
size = (
int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT))
)
codec = cv2.VideoWriter_fourcc(*'DIVX')
output = cv2.VideoWriter('videofile_masked.avi', codec, 60.0, size)
while(capture.isOpened()):
ret, frame = capture.read()
if ret:
# add mask to frame
results = model.detect([frame], verbose=0)
r = results[0]
frame = display_instances(
frame, r['rois'], r['masks'], r['class_ids'], class_names, r['scores']
)
output.write(frame)
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
capture.release()
output.release()
cv2.destroyAllWindows()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/impecunious/object-detection-masked-rcnn.git
git@gitee.com:impecunious/object-detection-masked-rcnn.git
impecunious
object-detection-masked-rcnn
object-detection-masked-rcnn
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385