i have been trying to access the camera in a frame using OpenCV but it has not worked, I used RTSP to connect it but it did not work. I will attach screenshots of the situation[this is the IP adress and port of the camera] (https://i.sstatic.net/f5B1V1Y6.png) [this is the official websites tutorial, i tried everything but it did not work also] (https://support.hanwhavisionamerica.com/hc/en-us/articles/236372028-What-are-the-RTSP-URLs-of-Hanwha-Devices)
when I try this code with my webcam it works, but whenever i try it with the camera it doesn’t work and gives me the following error
[ WARN:[email protected]] global cap_ffmpeg_impl.hpp:453 _opencv_ffmpeg_interrupt_callback Stream timeout triggered after 30105.778000 ms
< cv2.VideoCapture 000001D96447BC50>
Traceback (most recent call last):
File “C:UsersserdaPycharmProjectspythonProject5main.py”, line 8, in
cv2.imshow(‘video output’, img)
cv2.error: OpenCV(4.9.0) D:aopencv-pythonopencv-pythonopencvmoduleshighguisrcwindow.cpp:971: error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘cv::imshow’
import cv2
cap = cv2.VideoCapture('rtsp://admin:[email protected]:1026')
print(cap)
while True:
ret, img = cap.read()
cv2.imshow('video output', img)
k = cv2.waitKey(10)& 0xff
if k == 27:
break
cap.release()
cv2.destroyAllWindows()
Sufyan Serdah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.