2011-02-28 88 views
1

编辑:Array should be CvMat or IplImage不是特定于此问题的错误消息,这是我得到的唯一最相关的错误消息。OpenCV/Array应该是CvMat或IplImage /释放捕获对象


我试图使用opencv从应用程序中* * .exe。

我正在使用Python 2.6openCV 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 & pyinstaller打包我的应用程序,但输出是相同的。

我猜* .exe是缺少的东西,但我不知道如何调试它。

回答

4

这与包装商无关。

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

doc在谈论ReleaseCapture不过这个功能显然不是在Python绑定,调用:

del(self.cam)

做的工作刚刚好,self.cam是我CvCapture对象。