title: How to read video files using python & Opencv
body: <p>I am reading an avi file usinh python 2.7 and opencv2.4.I am using windows 10.My sample code is</p>
  
  <pre><code>import numpy as np
  import cv2
  cap = cv2.VideoCapture('videos/wa.avi')
  while(cap.isOpened()):
    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>When i run video is shown But the program ends with no Error</p>
  
  <pre><code>OpenCV Error: Assertion failed (size.width&gt;0 &amp;&amp; size.height&gt;0) in cv::imshow, file ..\..\..\..\opencv\modules\highgui\src\window.cpp, line 261
  Traceback (most recent call last):
  File "C:/Users/Emmanu/PycharmProjects/VideoEventDetection/test.py", line 11, in &lt;module&gt;
  cv2.imshow('frame',frame)
  cv2.error: ..\..\..\..\opencv\modules\highgui\src\window.cpp:261: error: (-215) size.width&gt;0 &amp;&amp; size.height&gt;0 in function cv::imshow
  </code></pre>
  
  <p>What i am doing wrong?How can i correct it?</p>