VideoCapture:捕获图形错误
我使用 Python (2.7) 包 VideoCapture。当我尝试实例化设备时,出现异常:
错误:无法创建捕获图。
我使用 cam = Device(),所以没有什么特别的。我有一台笔记本电脑,可以正常工作,而另一台笔记本电脑却出现异常。它们有所不同,但都有内置 USB 网络摄像头。
一周前它有效,但现在我只得到例外。两者都使用 Windows 7。
有谁知道如何解决这个问题,或者我如何获得更多信息出了什么问题?
谢谢。
I use the Python (2.7) package VideoCapture. When I try to instantiate the Device, I get an Exception:
Error: Capture Graph could not be created.
I use cam = Device()
, so nothing special there. I have one laptop where this works without a problem, and another where I get the Exception. They are different, but both have internal USB-Webcams.
One week ago it worked, but now I only get the exception. Both use Windows 7.
Does anybody have an idea how to resolve this, or how I could get more information what is wrong?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为出现此错误的原因有多种。
我第一次遇到它是因为我同时运行了另一个程序。关闭其他程序解决了该问题。
我第二次遇到这个问题是当我尝试同时使用两个摄像头,只是尝试立体视觉时。为了解决这个问题,我在两次捕获之间添加了延迟,然后我就可以运行它了。
我认为此错误的原因(以及为什么您可能在其他笔记本电脑上没有遇到它)是某些驱动程序似乎不能很好地处理同时访问。当您尝试快速连续地从设备驱动程序获取数据时,一些锁定不足的数据结构会变得混乱。
I think this error can appear for a variety of reasons.
The first time I encountered it, it was because I had another run of the program going at the same time. Closing the other program solved the issue.
The second time I ran into it was when I was trying to use two cameras at the same time, just experimenting with stereo vision. In order to get around this, I added a delay between the two captures and I could run it.
I think the reason for this error (and why you might not have encountered it on your other laptop), is that some drivers don't seem to handle simultaneous access very well. When you try to get data from the device drivers in rapid succession, some data structures that have insufficient locking get messed up.
我知道这是一个非常古老的线程。第二次实例化设备后,我不断收到此错误。将代码移至主线程解决了我的问题。
I know this is a really old thread. I kept getting this error after instantiating the Device a second time. Moving the code to the main thread fixed the problem for me.