title: OpenCV imshow window cannot be reused when called within a thread
body: <p>I'm having trouble using cv2 <code>imshow</code> when run in a separate python thread.</p>
  
  <p>The code below works for the first call of <code>start_cam</code>, but the second call fails - the cv2 camera window does not reappear. This seems to have something to do with threading prevent that window being reused, because:</p>
  
  <p>If the cv2 window is given a random name then it works indefinitely, although the window is not being reused as each window is new of course.</p>
  
  <p>If <code>_cam_loop()</code> is called without threading this it also works and the same window can be reused indefinitely.</p>
  
  <pre><code>def start_cam(self):
      self.cam_live = True
      threading.Thread(target = self._cam_loop).start()
  
  def stop_cam(self):
      self.cam_live = False
  
  def _cam_loop(self):
      while self.cam_live:
          img = self.cam.get_image()
          cv2.imshow("cam", img)
          cv2.waitKey(1)
  
  self.start_cam()   # live image window appears
  self.stop_cam()    # image window disappears (as thread is killed)
  self.start_cam()   # window fails to reappear
  </code></pre>
  
  <p>The window disappears when the thread finishes. Is there a way to keep a reference to the window after the thread finishes?</p>