title: OpenCV python video capture Error(-215) size.width>0 && size.height>0
body: <pre><code>import cv2
  import numpy as np
  
  cap = cv2.VideoCapture(0)
  
  while True:
      ret,frame = cap.read()
      cv2.imshow('frame',frame)
      k = cv2.waitKEy(10) &amp; 0xff
      if k == 27:
          break
  
  cap.release()
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>Hi all I'm a beginner and I'm just trying to video capture using opencv but I'm just confused because I get:</p>
  
  <blockquote>
    <p>error(-215) size.width>0 &amp;&amp; size.height>0 in function imshow</p>
  </blockquote>
  
  <p>and I cant find whats exactly wrong with it. Any help is greatly appreciated.</p>
  
  <p>My exact error is </p>
  
  <pre><code>Traceback (most recent call last):
  File "/home/pi/Desktop/videocapture.py", line 8,in &lt;module&gt;
    cv2.imshow('frame',frame)
  Error: /home/pi/opencv-3.0.0/modules/highgui/src/window.cpp:271: error: (-215) size.width&gt;0 &amp;&amp; size.height&gt;0 in function imshow
  </code></pre>
  
  <p>And I tried a few other ways as well but and sometimes I will get scn == 3||scn == 4</p>