title: cv2.imshow() function restart python shell without showing any error program stops
body: <p>I have written simple python code </p>
  
  <pre><code>    import cv2
      cam = cv2.VideoCapture(0)
      try: 
        for i in range(10):
           print i
           _,f=cam.read()
           cv2.imshow('f',f)
           k=cv2.waitKey(1)
  
      catch:
        print 'error'
  </code></pre>
  
  <p>this code only display 0 and quit working further python shell restarts 
  I am working with Respberry PI with python 2.7.9
  and Opencv 2.4.9.1</p>
  
  <p>When I remove cv2.imshow() line then code works fine. and it prints 0 to 9 all digits. It means cam is connected and opencv even reading images from camera but the issue is with displaying images</p>
  
  <p>Could any one find similar problem before or have any solution? please share thanks</p>