video
Cole Deck 5 years ago
parent 72d0015d8f
commit c40d84705f

Binary file not shown.

@ -332,12 +332,12 @@ def detect(calibration_width, img_file, show, quick):
cv2.putText(orig, str(objtype), cv2.putText(orig, str(objtype),
(int(x - 25), int(y + radius + 20) (int(x - 25), int(y + radius + 20)
), cv2.FONT_HERSHEY_SIMPLEX, ), cv2.FONT_HERSHEY_SIMPLEX,
0.55, (255, 255, 255), 2) 0.55, (0, 0, 255), 2)
else: else:
cv2.putText(orig, str(objtype), cv2.putText(orig, str(objtype),
(int(xpos2 + 10), int(ypos2 + 20) (int(xpos2 + 10), int(ypos2 + 20)
), cv2.FONT_HERSHEY_SIMPLEX, ), cv2.FONT_HERSHEY_SIMPLEX,
0.55, (255, 255, 255), 2) 0.55, (0, 0, 255), 2)
output = "" output = ""
objname = objtype; objname = objtype;
if objtype == "Unknown": if objtype == "Unknown":
@ -353,12 +353,12 @@ def detect(calibration_width, img_file, show, quick):
cv2.putText(orig, output, # print data cv2.putText(orig, output, # print data
(int(x - 25), int(y + radius + 35) (int(x - 25), int(y + radius + 35)
), cv2.FONT_HERSHEY_SIMPLEX, ), cv2.FONT_HERSHEY_SIMPLEX,
0.5, (255, 255, 255), 1) 0.5, (0, 0, 255), 1)
else: else:
cv2.putText(orig, output, # print data cv2.putText(orig, output, # print data
(int(xpos2 + 10), int(ypos2 + 35) (int(xpos2 + 10), int(ypos2 + 35)
), cv2.FONT_HERSHEY_SIMPLEX, ), cv2.FONT_HERSHEY_SIMPLEX,
0.5, (255, 255, 255), 1) 0.5, (0, 0, 255), 1)
# show the output image # show the output image
if show: if show:

@ -15,8 +15,11 @@ if not video:
elapsed_time = timeit.timeit(go, number=3)/3 elapsed_time = timeit.timeit(go, number=3)/3
print(elapsed_time) print(elapsed_time)
else : 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 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() #ret,frame = capture.read()
#detect.detect(calibration_width, "img7.jpg", True, False) #detect.detect(calibration_width, "img7.jpg", True, False)
#detect.detect(calibration_width, frame, True, True) #detect.detect(calibration_width, frame, True, True)
@ -28,7 +31,7 @@ else :
print('empty frame') print('empty frame')
break break
#print('frame') #print('frame')
if x > 0: if x > 1:
ret,frame = capture.retrieve() ret,frame = capture.retrieve()
cv2.imshow('Item Sorter', detect.detect(calibration_width, frame, True, True)) cv2.imshow('Item Sorter', detect.detect(calibration_width, frame, True, True))
x = 0 x = 0

Loading…
Cancel
Save