Python中文
首页
教程
问答
标签
搜索
登录
注册
Open cv 3 Python 3 AttributeError:模块“cv2”没有属性“VideoCapture”Windows 10
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我想用windows10上的opencvv3和python3.5从我的网络摄像头中加载一个实时视频,但是我总是得到这样一个“AttributeError:cv2”模块在从文件加载时没有属性“VideoCapture”。当我使用shell导入cv2时,所有模块都是可访问的。但是当我使用<code>dir(cv2)</code>并在一个文件中运行它时,我只看到几个模块。这是我的密码</p> <pre><code>import numpy as np import cv2 cap = cv2.VideoCapture(0) while(True): ret, frame = cap.read() gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) cv2.imshow('frame',gray) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows() </code></pre> <p>如何从cv2访问“VideoCapture”属性?我需要帮助。我在网上找到的所有解决方案似乎都不管用。谢谢</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>我不确定这是否能解决这个问题,但我在使用opencv3.3/opencv2.4和python3.5时遇到了一个问题。我切换到Python2.7,修复了许多崩溃和类似的错误。我在我的项目中使用了cv2.VideoCapture(),它的工作原理很有魅力!(使用opencv3.3和Python2.7)</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何在乒乓球比赛中预测球的轨迹,对于AI球拍预测?
9 回答
如何在乒乓球游戏中阻止球
9 回答
如何在乘法和模中不乘空间?
5 回答
如何在乘法和除以2个不同的数字之间进行交换?
6 回答
如何在也是数据一部分的单个字符上拆分大字符串
7 回答
如何在乾草堆中找到針,有更好的解決方案嗎?
7 回答
如何在事件wxWidgets中传递自定义数据
7 回答
如何在事件中使用lambda i=i?
3 回答
如何在事件中心只接收最近的数据
9 回答
如何在事件发生之前保持云函数运行?
5 回答
如何在事件发生后使页面重定向到同一页面
9 回答
如何在事件回调之间保持python生成器的状态
7 回答
如何在事件处理程序(pythonsocket、sphinx)中保留docstring
4 回答
如何在事件处理程序中更改wxRichTextCtrl的光标位置?
7 回答
如何在事件处理程序中访问外部对象?
8 回答
如何在事件循环中将协程打包为正常函数?
7 回答
如何在事件循环之外运行协同程序?
7 回答
如何在事件循环结束时为并发未来的所有线程调用类方法?
8 回答
如何在事件文件中只保留一份摘要?
1 回答
如何在事件模板中添加事件
3 回答