diff --git a/__pycache__/detect.cpython-38.pyc b/__pycache__/detect.cpython-38.pyc index 6424b2e..66e3f48 100644 Binary files a/__pycache__/detect.cpython-38.pyc and b/__pycache__/detect.cpython-38.pyc differ diff --git a/detect.py b/detect.py index 353a6e0..4f62c97 100644 --- a/detect.py +++ b/detect.py @@ -332,12 +332,12 @@ def detect(calibration_width, img_file, show, quick): cv2.putText(orig, str(objtype), (int(x - 25), int(y + radius + 20) ), cv2.FONT_HERSHEY_SIMPLEX, - 0.55, (255, 255, 255), 2) + 0.55, (0, 0, 255), 2) else: cv2.putText(orig, str(objtype), (int(xpos2 + 10), int(ypos2 + 20) ), cv2.FONT_HERSHEY_SIMPLEX, - 0.55, (255, 255, 255), 2) + 0.55, (0, 0, 255), 2) output = "" objname = objtype; if objtype == "Unknown": @@ -353,12 +353,12 @@ def detect(calibration_width, img_file, show, quick): cv2.putText(orig, output, # print data (int(x - 25), int(y + radius + 35) ), cv2.FONT_HERSHEY_SIMPLEX, - 0.5, (255, 255, 255), 1) + 0.5, (0, 0, 255), 1) else: cv2.putText(orig, output, # print data (int(xpos2 + 10), int(ypos2 + 35) ), cv2.FONT_HERSHEY_SIMPLEX, - 0.5, (255, 255, 255), 1) + 0.5, (0, 0, 255), 1) # show the output image if show: diff --git a/run_detect.py b/run_detect.py index 378e5ce..72301a6 100644 --- a/run_detect.py +++ b/run_detect.py @@ -15,8 +15,11 @@ if not video: elapsed_time = timeit.timeit(go, number=3)/3 print(elapsed_time) else : - capture = cv2.VideoCapture('udpclientsrc host=192.168.43.152 port=5001 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! videorate ! video/x-raw,framerate=5/1 ! appsink', cv2.CAP_GSTREAMER) + #tcp capture = cv2.VideoCapture('udpsrc port=5001 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! videorate ! video/x-raw,framerate=5/1 ! appsink', cv2.CAP_GSTREAMER) + capture = cv2.VideoCapture('udpsrc port=9000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! rtph264depay ! avdec_h264 ! videoconvert ! appsink sync=false', cv2.CAP_GSTREAMER) + # server command for imx135 camera ./video2stdout | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=192.168.43.152 port=5001 + # server command for udp: ./video2stdout | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.43.40 port=9000 #ret,frame = capture.read() #detect.detect(calibration_width, "img7.jpg", True, False) #detect.detect(calibration_width, frame, True, True) @@ -28,7 +31,7 @@ else : print('empty frame') break #print('frame') - if x > 0: + if x > 1: ret,frame = capture.retrieve() cv2.imshow('Item Sorter', detect.detect(calibration_width, frame, True, True)) x = 0