0

I am working on the activity detection when i try to capture video from IP camera its shows the error. Code =

import cv2

cap=cv2.VideoCapture('http://38.101.209.29:8082')

while True:
    ret,frame =cap.read()

    cv2.imshow('frame',frame)
    if cv2.waitKey(1)&0xFF ==ord('q'):
        break
cap.release()
cv2.destroyAllwindows()

the error traceback is

Traceback (most recent call last)
<ipython-input-5-dd9c83e9ec5b> in <module>
      5     ret,frame =cap.read()
      6 
----> 7     cv2.imshow('frame',frame)
      8     if cv2.waitKey(1)&0xFF ==ord('q'):
      9         break

error: OpenCV(4.1.1) D:\Build\OpenCV\opencv-4.1.1\modules\highgui\src\window.cpp:360: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
nathancy
  • 42,661
  • 14
  • 115
  • 137
fahad
  • 21
  • 5
  • Did you get a chance to look at this: https://stackoverflow.com/questions/31586385/assertion-failure-size-width0-size-height0-in-function-imshow? – Sai Oct 04 '19 at 17:30
  • Possible duplicate of [Assertion failure : size.width>0 && size.height>0 in function imshow](https://stackoverflow.com/questions/31586385/assertion-failure-size-width0-size-height0-in-function-imshow) – Sai Oct 04 '19 at 17:31
  • Check to ensure that you can open the IP stream with `if cap.isOpened()`. Also check to see that the frame is valid with `if ret:` – nathancy Oct 04 '19 at 20:06

0 Answers0