栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何实时处理图像并输出结果的实时视频?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何实时处理图像并输出结果的实时视频?

您可能需要看一下这个问题:使用直接使用VideoCapture的实时摄像机预览来更新matplotlib中的帧。相反,如果您想从http中读取图像,则可以将其更改为以下内容之一。

互动模式

import cv2import matplotlib.pyplot as pltdef grab_frame():    image = io.imread('http://[ip-address]/cam_pic.php')    image_gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)    faces = detect(image_gray)    return faces_draw(image, faces)#create axesax1 = plt.subplot(111)#create image plotim1 = ax1.imshow(grab_frame())plt.ion()while True:    im1.set_data(grab_frame())    plt.pause(0.2)plt.ioff() # due to infinite loop, this gets never called.plt.show()

功能动画

import cv2import matplotlib.pyplot as pltfrom matplotlib.animation import FuncAnimationdef grab_frame():    image = io.imread('http://[ip-address]/cam_pic.php')    image_gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)    faces = detect(image_gray)    return faces_draw(image, faces)#create axesax1 = plt.subplot(111)#create axesim1 = ax1.imshow(grab_frame())def update(i):    im1.set_data(grab_frame())ani = FuncAnimation(plt.gcf(), update, interval=200)plt.show()


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/662276.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号