|
|
@ -1,6 +1,7 @@
|
|
|
|
import detect
|
|
|
|
import detect
|
|
|
|
import timeit
|
|
|
|
import timeit
|
|
|
|
import cv2
|
|
|
|
import cv2
|
|
|
|
|
|
|
|
from imutils.video import FPS
|
|
|
|
calibration_width = 0.75
|
|
|
|
calibration_width = 0.75
|
|
|
|
image = "img7.jpg"
|
|
|
|
image = "img7.jpg"
|
|
|
|
images = ("img.jpg", "img2.jpg", "img3.jpg", "img4.jpg", "img5.jpg", "img6.jpg", "img7.jpg", "img8.jpg")
|
|
|
|
images = ("img.jpg", "img2.jpg", "img3.jpg", "img4.jpg", "img5.jpg", "img6.jpg", "img7.jpg", "img8.jpg")
|
|
|
@ -14,19 +15,22 @@ 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('tcpclientsrc host=192.168.86.108 port=5001 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! appsink', cv2.CAP_GSTREAMER)
|
|
|
|
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)
|
|
|
|
# server command for pi camera /opt/vc/bin/raspivid -t 0 -w 1920 -h 1080 -hf -fps 5 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=192.168.86.108 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
|
|
|
|
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)
|
|
|
|
|
|
|
|
x = 0
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
ret,frame = capture.read()
|
|
|
|
ret = capture.grab()
|
|
|
|
|
|
|
|
x+=1
|
|
|
|
if not ret:
|
|
|
|
if not ret:
|
|
|
|
print('empty frame')
|
|
|
|
print('empty frame')
|
|
|
|
break
|
|
|
|
break
|
|
|
|
#print('frame')
|
|
|
|
#print('frame')
|
|
|
|
|
|
|
|
if x > 0:
|
|
|
|
|
|
|
|
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
|
|
|
|
if cv2.waitKey(1)&0xFF == ord('q'):
|
|
|
|
if cv2.waitKey(1)&0xFF == ord('q'):
|
|
|
|
break
|
|
|
|
break
|
|
|
|