From b1f7129b909c9055cff4f5546716432dcdca6a1a Mon Sep 17 00:00:00 2001 From: Cole Deck Date: Thu, 12 Dec 2019 11:28:43 -0600 Subject: [PATCH] attempt to load video stream from pi directly (not working yet) --- run_detect.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/run_detect.py b/run_detect.py index de6469c..51e8040 100644 --- a/run_detect.py +++ b/run_detect.py @@ -1,5 +1,6 @@ import detect import timeit +import cv2 calibration_width = 0.75 image = "img7.jpg" images = ("img.jpg", "img2.jpg", "img3.jpg", "img4.jpg", "img5.jpg", "img6.jpg", "img7.jpg", "img8.jpg") @@ -8,5 +9,16 @@ def go(): #for file in images: detect.detect(calibration_width, "img7.jpg", show) -elapsed_time = timeit.timeit(go, number=100)/100 -print(elapsed_time) \ No newline at end of file +#elapsed_time = timeit.timeit(go, number=100)/100 +#print(elapsed_time) +capture = cv2.VideoCapture('tcpclientsrc host=192.168.43.152 port=5000 ! queue ! decodebin ! appsink', cv2.CAP_GSTREAMER) +while True: + ret,frame = capture.read() + + if not ret: + print('empty frame') + break + print('frame') + cv2.imshow('receive', frame) + if cv2.waitKey(1)&0xFF == ord('q'): + break