0

instructions to stream IP Camera video utilizing just python in windows OS

import numpy as np
import cv2

cap = cv2.VideoCapture('http://admin:*****@198.168.1.***')

while(True):

    ret, frame = cap.read()
    cv2.imshow('Stream IP Camera OpenCV',frame)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()
marchoy
  • 121
  • 1
  • 8
Step In
  • 31
  • 4
  • 1
    welcome to StackOverflow! Can you help us understand your issue? Is the code throwing an error? Is the code running fine but you are not able to read the stream? – raghav710 Apr 01 '19 at 05:17
  • code throwing an error – Step In Apr 01 '19 at 05:31
  • this is the error send by that code: ("OpenCV(4.0.0) C:\\projects\\opencv-python\\opencv\\modules\\highgui\\src\\window.cpp:350: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'\n",) – Step In Apr 01 '19 at 06:22
  • Please take a look at:https://stackoverflow.com/questions/27953069/opencv-error-215size-width0-size-height0-in-function-imshow – raghav710 Apr 01 '19 at 06:34
  • was your issue resolved? – raghav710 Apr 04 '19 at 02:52

1 Answers1

0

This error means that cap.read() does not capture the video/frame. The problem is most likely on line cap = cv2.VideoCapture('http://admin:*****@198.168.1.***'). Make sure the ip address of camera and ip address of your computer are properly configured according to documentation.

Fisa
  • 440
  • 4
  • 19