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

发布于 2024-10-19 13:04:34 字数 2306 浏览 2 评论 0原文

编辑: Array should be CvMat or 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 缺少一些东西,但我不知道什么,也不知道如何调试它。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

星光不落少年眉 2024-10-26 13:04:34

这与包装商无关。

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

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

del(self.cam)

很好地完成了工作,self.cam是我的CvCapture代码>对象。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文