OpenCV / Array应该是CvMat或IplImage /释放捕获对象 [英] OpenCV / Array should be CvMat or IplImage / Releasing a capture object

查看:995
本文介绍了OpenCV / Array应该是CvMat或IplImage /释放捕获对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑: 数组应该是CvMat或IplImage 不是特定于此问题的错误消息,这是唯一最相关的错误消息。

Edit : Array should be CvMat or IplImage is not an error message specific to this issue, that's the only most relevant error message i got.

我试图使用opencv从一个应用程序中创建一个* .exe。

I'm trying to make an *.exe out of an application using opencv.

我正在使用 Python 2.6 openCV 2.1

运行的一部分* .exe,我有一个菜单,我可以选择从两个不同的源处理一些图片我的网络摄像头&静态图像。静态图像部分工作,但当我选择网络摄像头这里是输出:

I can run part of the *.exe, i'm having a menu from where i can choose to process some pictures from 2 differents sources my webcam & a static image. The static image part works but when i'm chosing the webcam here is the output:

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给我这个输出:

Building the *.exe with py2exe gave me this output :


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



我不知道,与我的来源。我试图打包我的应用程序与py2exe& pyinstaller,但输出是一样的。

I don't get it, this is working with my sources. I tried to pack my application with py2exe & pyinstaller, but the output is the same.

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

I guess the *.exe is missing something but i don't know what neither how to debug it.

推荐答案

这与包装商无关。

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

The problem was that I wasn't closing the webcam capture, several processes of my app were actually running in the background.

doc 是关于 ReleaseCapture ,但是这个函数显然不是在python绑定,调用:

The doc is talking about ReleaseCapture but this function is apparently not in the python bindings, calling :

del(self.cam)

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

did the job just well, self.cam being my CvCapture object.

这篇关于OpenCV / Array应该是CvMat或IplImage /释放捕获对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆