title: Python - Open CV Error on webcam video capture
body: <p>I'm new to python and opencv. 
  I have tried capturing video using cv2.VideoCapture(0), as I have my default video camera as my laptop camera. coded using pycharm and tried all the basic troubleshooting to fix the error. below is my code.
  but i tried for cv2.imread('a.jpg') it's working and able to see the pic </p>
  
  <pre><code>import cv2
  cap = cv2.VideoCapture(0)
  while True:
  
      ret, frame = cap.read()
      cv2.imshow('frame', frame)
      if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break
  
  cap.release()
  cv2.destroyAllWindows()```
  
  
  getting error like this
  
  exec(compile(contents+"\n", file, 'exec'), glob, loc)
    File "C:/Users/user2/PycharmProjects/FaceDetect/faceDetect.py", line 6, in &lt;module&gt;
      cv2.imshow('frame', frame)
  cv2.error: OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:376: error: (-215:Assertion failed) size.width&gt;0 &amp;&amp; size.height&gt;0 in function 'cv::imshow'
  
  
  
  </code></pre>