title: SimpleCV and multithreading
body: <p>I'm trying to use SimpleCV for image capture in Python (Windows). Capture is performed inside a function, which I want to run inside a thread. This is my code:</p>
  
  <pre><code># -*- encoding: utf-8 -*-
  
  import threading
  import time
  from SimpleCV import Camera
  
  def run(filename):
      # Initialize the camera
      cam = Camera(0, {"width": 640, "height": 480})
      while 1:
          img = cam.getImage()
          img.save(filename, quality=50, optimize=True, progressive=True)
          time.sleep(3)
  
  
  filename = "C:/SimpleCV/image.jpeg"
  
  t = threading.Thread(target=run, args=(filename,))
  t.start()
  
  while(1):
      time.sleep(1) 
  </code></pre>
  
  <p>If I call the run() function directly (with no threads) everything's ok. However, when using a thread (as in the above code), Windows shows a dialog asking for the capture source and program crashes. What's the problem?</p>
  
  <p>Error codes:</p>
  
  <pre><code>OpenCV Error: Bad argument (Array should be CvMat or IplImage) in unknown function, file C:\slave\WinInstallerMegaPack\src\opencv\modules\core\src\array.cpp, line 1238
  Exception in thread Thread-1:
  Traceback (most recent call last):
    File "C:\Python27\lib\threading.py", line 551, in __bootstrap_inner
      self.run()
    File "C:\Python27\lib\threading.py", line 504, in run
      self.__target(*self.__args, **self.__kwargs)
    File "C:/SimpleCV/test.py", line 12, in run
      img = cam.getImage()
    File "C:\Python27\lib\site-packages\SimpleCV\Camera.py", line 586, in getImage
      newimg = cv.CreateImage(cv.GetSize(frame), cv.IPL_DEPTH_8U, 3)
  error: Array should be CvMat or IplImage 
  </code></pre>