title: Viewing images from IP cameras
body: <p>I am writing through a translator</p>
  
  <p>I have a code</p>
  
  <pre><code>import cv2
  
  stream = cv2.VideoCapture('protocol://IP:port/1') 
  
  while True:
      r, f = stream.read()
      cv2.imshow('IP Camera stream',f)
  
      if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break
  
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>if I could not get the stream from the camera but I get an error</p>
  
  <pre><code>Traceback (most recent call last):
  File "C:\Users\User\Desktop\Proge\good2.py", line 10, in &lt;module&gt;
      cv2.imshow('IP Camera stream',f)
  cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:352: error: (-215:Assertion failed) size.width&gt;0 &amp;&amp; size.height&gt;0 in function 'cv::imshow'
  </code></pre>
  
  <p>How to add a check whether the image is received or is it empty?</p>
  
  <p>Or something like that to avoid mistakes</p>
  
  <p>Thank you in advance</p>