title: OpenCV / Array should be CvMat or IplImage / Releasing a capture object
body: <p><strong>Edit :</strong> <code>Array should be CvMat or IplImage</code> is not an error message specific to this issue, that's the only most relevant error message i got.</p>
  
  <hr>
  
  <p>I'm trying to make an *.exe out of an application using opencv.</p>
  
  <p>I'm using <strong>Python 2.6</strong> and <strong>openCV 2.1</strong>.</p>
  
  <p>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 &amp; a static image. The static image part works but when i'm chosing the webcam here is the output:</p>
  
  <pre>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'
  </pre>
  
  <p>My <a href="http://paste.pocoo.org/show/345671/" rel="nofollow">pyar.py</a> file.</p>
  
  <p>Building the *.exe with py2exe gave me this output :</p>
  
  <pre>
  The following modules appear to be missing
  ['ICCProfile', '_imaging_gif', '_scproxy']
  </pre>
  
  <p>I don't get it, this is working with my sources. I tried to pack my application with py2exe &amp; pyinstaller, but the output is the same.</p>
  
  <p>I guess the *.exe is missing something but i don't know what neither how to debug it.</p>