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()