title: OpenCv code throws segmentation error(core dumped) Ubuntu 14.04
body: <p>I'm beginner learning opencv from the official documentation <a href="http://docs.opencv.org/trunk/doc/py_tutorials/py_gui/py_video_display/py_video_display.html#display-video" rel="nofollow">http://docs.opencv.org/trunk/doc/py_tutorials/py_gui/py_video_display/py_video_display.html#display-video</a></p>
  
  <pre><code>import numpy as np        
  import cv2    
  
  cap = cv2.VideoCapture(0)      
  while(True):    
      ret, frame = cap.read()
      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
      cv2.imshow('frame',gray)
      if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break
  
  cap.release()
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>It's giving me error <code>"Segmentation fault (core dumped)"</code> 
  Can anyone please tell me Why is that happening and how to resolve that issue?<br>
  Thanks in advance.</p>