python cv2 膨胀操作 cvmat_OpenCV / Array应该是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.

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

I'm using Python 2.6 and openCV 2.1.

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'

My pyar.py file.

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

The following modules appear to be missing

['ICCProfile', '_imaging_gif', '_scproxy']

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.

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

解决方案

It was not related to the packagers.

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

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

del(self.cam)

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值