python - 如何在python,opencv中的构造函数内部读取相机帧
问题描述
我陷入了一个问题。我想在放置在构造函数内的函数中读取相机帧。问题是视频流无法启动。窗户挂了。
代码
class MyCLass:
def __init__(self. root):
self.root = root
def video_stream():
print("[INFO] starting video stream...")
vs = VideoStream(src=0).start()
writer = None
# time.sleep(2.0)
# loop over frames from the video file stream
while True:
# grab the frame from the threaded video stream
frame = vs.read()
cv2.imshow("Frame", frame)
video_stream()
解决方案
推荐阅读
- alarmmanager - AlarmManager 或 JobScheduler 是否兼容所有 Android 版本?
- bash - 如何使用循环并行处理函数
- python - 如何返回 python 字典以在其他函数中使用?
- reactjs - 在三元运算符中反应多个条件?
- javascript - nodejs集群中从worker到worker的消息
- javascript - 如何将数组变成对象的对象
- javascript - 将我的 JavaScript 压缩成更小的代码
- elasticsearch - ElasticSearch 和 NEST 6.x:将复杂对象映射到字符串
- vb.net - 绑定和 DBNull 问题。异常只引发一次
- c# - 在c#中修剪字符串输出最后一个字符串