title: Error, but nothing seems to be wrong? cv2 - python
body: <p>I followed a tutorial line by line on YouTube, and it worked. As this is my first time doing recognition stuff</p>
  <p>I haven't changed anything and now it's giving me an error.</p>
  <pre class="lang-py prettyprint-override"><code>import cv2
  
  url = 'http//192.168.1.88:4747/video'
  cap = cv2.VideoCapture(url)
  face_cascade = cv2.CascadeClassifier(&quot;Lib\\site-packages\\cv2\\data\\haarcascade_frontalface_alt2.xml&quot;)
  
  while True:
      ret, frame = cap.read()
      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # &lt;----------THIS LINE IS GIVING ME THE ERROR
      face = face_cascade.detectMultiScale(gray, 1.5, 5)
  
      for(x,y,w,h) in faces:
          print(x,y,w,h)
          cv2.rectangle(gray, (x,y), (x+w, y+h), (255,0,0), 5)
  
      cv2.imshow('Window', frame)
      if cv2.waitKey(1) &amp; 0xff == ord('q'):
          break
  
  cv2.destroyAllWindows()
  </code></pre>
  <p>I've tried deleting the whole code-block and rewriting it but I still get the error. Its like that saying, <em>only an idiot does the same thing over and over expecting a different result</em>.</p>
  <p>Here is the error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;C:/Users/Tomas/PycharmProjects/Webcam Phone/venv/Webcam.py&quot;, line 9, in &lt;module&gt;
      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
  cv2.error: OpenCV(4.3.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
  </code></pre>