25 lines
560 B
Python
25 lines
560 B
Python
import cv2 as cv
|
|
import time
|
|
|
|
ip = "192.168.137.100"
|
|
vid = cv.VideoCapture(f"http://{ip}:8080/video?1920x1080")
|
|
|
|
cv.namedWindow("Stream", cv.WINDOW_NORMAL)
|
|
|
|
while True:
|
|
ret, frame = vid.read()
|
|
|
|
if not ret:
|
|
raise Exception("Failed to read image!")
|
|
|
|
cv.imshow("Stream", frame)
|
|
|
|
# Set window size once, after the window actually exists
|
|
if cv.getWindowProperty("Stream", cv.WND_PROP_VISIBLE) >= 0:
|
|
cv.resizeWindow("Stream", 1280, 720)
|
|
|
|
if cv.waitKey(1) & 0xFF == ord("q"):
|
|
break
|
|
|
|
vid.release()
|
|
cv.destroyAllWindows() |