0

i'm using python=3.5 and OpenCV 3.1.4 to establish a connection with my IP camera via RTSP protocol and by using wifi on Raspberry Pi 3 B

here's my code

import cv2
from imutils.video import WebcamVideoStream
vs = WebcamVideoStream(src="rtsp://192.168.1.4").start()
while 1:
    frame = vs.read()
    cv2.imshow("video",frame)
    if cv2.waitkey(1) & 0xFF == ord('q'):
        break
vs.release()


    OpenCV(3.4.1) Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/pi/opencv-3.4.1/modules/highgui/src/window.cpp, line 356
Traceback (most recent call last):
  File "ip_cam.py", line 8, in <module>
    cv2.imshow("video",frame)
cv2.error: OpenCV(3.4.1) /home/pi/opencv-3.4.1/modules/highgui/src/window.cpp:356: error: (-215) size.width>0 && size.height>0 in function imshow

from the error its clear that frames are not being captured from the supplied connection which means connection is not properly established. this code was working perfectly fine when i ran it on ubuntu when i ran it on raspberry pi rasbian stretch kernel version 4.14 i got this error.

Can anyone guide me through how i can read and process frames from IP camera in python and openCV connected through WiFi.

  • did you ever solve your problem? – Gazihan Alankus Nov 21 '18 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.