Python calls Haikang network camera to display monitoring content in real time

Connect the Hikvision camera to the computer with a network cable; (or use a switch, under a switch)

The default ip of Hikvision camera is 192.168.1.64

Effect: the same effect as through the URL of the Hikvision camera
insert image description here

rtsp://username:password@ip address/Streaming/Channels/2

 
import cv2
url = "rtsp://admin:[email protected]/Streaming/Channels/2"
cap = cv2.VideoCapture(url)
ret, frame = cap.read()
while ret:
    ret, frame = cap.read()
    cv2.imshow("frame",frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
cv2.destroyAllWindows()
cap.release()

Guess you like

Origin blog.csdn.net/weixin_43096365/article/details/129275863
Recommended