OpenCV / Array应该是CvMat或IplImage /释放捕获对象

时间:2011-02-28 09:35:23

标签: python opencv camera release capture

编辑: Array should be CvMat or IplImage不是特定于此问题的错误消息,这是我收到的唯一最相关的错误消息。


我正在尝试使用opencv从应用程序中创建* .exe。

我正在使用 Python 2.6 openCV 2.1

我可以运行* .exe的一部分,我有一个菜单,我可以从中选择处理来自2个不同来源的一些图片我的网络摄像头和放大器静态图像。静态图像部分可以正常工作,但是当我选择网络摄像头时,这是输出:

OpenCV Error: Bad argument (Array should be CvMat or IplImage) in unknown function, file ..\..\..\..\ocv\opencv\src\cxcore\cxarray.cpp,
 line 1233
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 295, in 'calling callback function'
  File "game_ar\build\pyi.win32\game_ar\outPYZ1.pyz/pyglet.window.win32", line 849, in _wnd_proc
  File "game_ar\build\pyi.win32\game_ar\outPYZ1.pyz/pyglet.window.win32", line 918, in _event_key
  File "game_ar\build\pyi.win32\game_ar\outPYZ1.pyz/pyglet.window", line 1219, in dispatch_event
  File "game_ar\build\pyi.win32\game_ar\outPYZ1.pyz/pyglet.event", line 340, in dispatch_event
  File "", line 502, in on_key_press
  File "", line 461, in dostart
  File "", line 482, in getpoints
  File "D:\Prog\Python\AugmentedR\src\pyar.py", line 40, in get_points
    pilimage = Image.fromstring("RGB", cv.GetSize(image), image.tostring())
cv.error: Array should be CvMat or IplImage
Traceback (most recent call last):
  File "", line 616, in 
  File "game_ar\build\pyi.win32\game_ar\outPYZ1.pyz/pyglet.app", line 264, in run
  File "game_ar\build\pyi.win32\game_ar\outPYZ1.pyz/pyglet.app.win32", line 63, in run
  File "game_ar\build\pyi.win32\game_ar\outPYZ1.pyz/pyglet.app.win32", line 84, in _timer_func
  File "game_ar\build\pyi.win32\game_ar\outPYZ1.pyz/pyglet.app", line 193, in idle
  File "game_ar\build\pyi.win32\game_ar\outPYZ1.pyz/pyglet.window", line 1219, in dispatch_event
  File "game_ar\build\pyi.win32\game_ar\outPYZ1.pyz/pyglet.event", line 340, in dispatch_event
  File "", line 546, in on_draw
AttributeError: Game instance has no attribute 'bg'

我的pyar.py档案。

用py2exe构建* .exe给了我这个输出:

The following modules appear to be missing
['ICCProfile', '_imaging_gif', '_scproxy']

我不明白,这与我的消息来源合作。我试着用py2exe和amp;打包我的应用程序pyinstaller,但输出是一样的。

我猜* .exe缺少一些东西,但我不知道怎么调试它。

1 个答案:

答案 0 :(得分:4)

与包装商无关。

问题是我没有关闭网络摄像头捕获,我的应用程序的几个进程实际上是在后台运行。

doc正在讨论ReleaseCapture,但这个函数显然不在python绑定中,调用:

del(self.cam)

做得很好,self.cam是我的CvCapture对象。