From a1ee1b9e8cc0435bdceaf69a1782d32806a10e7c Mon Sep 17 00:00:00 2001 From: Pavol Debnar Date: Sun, 5 Mar 2023 20:38:14 +0100 Subject: [PATCH] added base camera streaming client --- src/cam.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/cam.py diff --git a/src/cam.py b/src/cam.py new file mode 100644 index 0000000..f3fff94 --- /dev/null +++ b/src/cam.py @@ -0,0 +1,24 @@ +import cv2 +import numpy as np +import os + +os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"]="rtsp_transport;tcp" + +gstreamerstr = "tcpclientsrc host=192.168.0.144 port=5000 ! jpegdec ! videoconvert ! appsink" + + + +#if not capture.isOpened() : print("CANNOT OPEN STREAM") + +while(True): + capture = cv2.VideoCapture(gstreamerstr,cv2.CAP_GSTREAMER) + ret, frame = capture.read() + if not ret: + print('fail') + break + cv2.imshow('frame',frame) + cv2.waitKey(1) + + +capture.release() +cv2.destroyAllWindows()