【发布时间】:2014-01-22 17:32:04
【问题描述】:
我正在使用 Python cv2 模块来运行程序。
我可以访问内置网络摄像头,但是当我使用外部网络摄像头时,它不起作用。
我用过所有的代码,比如
VideoCapture(1) # or any other no.s like 0,1,2,3 etc etc.
我什至使用设备管理器禁用了内置网络摄像头。
但没有任何效果。我正在使用pythonxy。我也试过在命令提示符下。还是不行。
我收到以下错误
runfile('C:/Users/Prashant/Documents/Python Scripts/Circledetection.py', wdir=r'C:/Users/Prashant/Documents/Python Scripts')
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in unknown function, file ..\..\..\modules\imgproc\src\color.cpp, line 3402
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 540, in runfile
execfile(filename, namespace)
File "C:/Users/Prashant/Documents/Python Scripts/Circledetection.py", line 27, in <module>
prev_gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
cv2.error: ..\..\..\modules\imgproc\src\color.cpp:3402: error: (-215) scn == 3 || scn == 4
【问题讨论】:
-
错误只是指出,您的图像是空的(因为未打开捕获。)尝试为您的外部网络摄像头安装适当的驱动程序。
-
我可以使用 win8 相机应用程序中的网络摄像头 .. 当我从设备管理器检查更新驱动程序时,它显示“Windows 已确定您设备的驱动程序软件是最新的” .