title: OpenCV/Python: VideoCapture can't read the last frame correctly
body: <p>I'm using openCv and python 2.7. </p>
  
  <p>I'm trying to read a video but the last frame has no type and I can't show it.</p>
  
  <p>My video has 16 frames and frame rate is 4fps.</p>
  
  <p>Printing the types of the frames I get:</p>
  
  <pre><code>&lt;type 'numpy.ndarray'&gt;
  &lt;type 'numpy.ndarray'&gt;
  &lt;type 'numpy.ndarray'&gt;
  ...
  &lt;type 'numpy.ndarray'&gt;
  &lt;type 'NoneType'&gt;
  OpenCV Error: Assertion failed (size.width&gt;0 &amp;&amp; size.height&gt;0) in cv::imshow, fi
  le C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\highgui\src\
  window.cpp, line 271
  Traceback (most recent call last):
    File "3_1.py", line 113, in &lt;module&gt;
      cv2.imshow('frame',frame)
  cv2.error: C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\high
  gui\src\window.cpp:271: error: (-215) size.width&gt;0 &amp;&amp; size.height&gt;0 in function
  cv::imshow
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>cap_2 = cv2.VideoCapture('video.avi')
  while(cap_2.isOpened()):
      ret, frame = cap_2.read()
  
      print type(frame)
      cv2.imshow('frame',frame)
      if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break
  
  
  cap_2.release()
  cv2.destroyAllWindows()
  </code></pre>