|
|
@ -47,6 +47,7 @@ else :
|
|
|
|
host = '' # Symbolic name meaning all available interfaces
|
|
|
|
host = '' # Symbolic name meaning all available interfaces
|
|
|
|
port = 9001 # Arbitrary non-privileged port
|
|
|
|
port = 9001 # Arbitrary non-privileged port
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
|
|
|
|
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
|
|
#s.setsockopt(s, socket.SOL_SOCKET, socket.SO_REUSEADDR)
|
|
|
|
#s.setsockopt(s, socket.SOL_SOCKET, socket.SO_REUSEADDR)
|
|
|
|
s.bind((host, port))
|
|
|
|
s.bind((host, port))
|
|
|
|
print("[ INFO ] TCP stream initialized. Waiting for client...")
|
|
|
|
print("[ INFO ] TCP stream initialized. Waiting for client...")
|
|
|
@ -80,7 +81,8 @@ else :
|
|
|
|
#print('frame')
|
|
|
|
#print('frame')
|
|
|
|
if x > 1:
|
|
|
|
if x > 1:
|
|
|
|
ret,frame = capture.retrieve()
|
|
|
|
ret,frame = capture.retrieve()
|
|
|
|
frame = frame[130:1120, 275:1350]
|
|
|
|
frame = frame[130:1100, 300:1300]
|
|
|
|
|
|
|
|
#frame = frame[170:900, 475:1100]
|
|
|
|
items,output = detect.detect(calibration_width, frame, True, True)
|
|
|
|
items,output = detect.detect(calibration_width, frame, True, True)
|
|
|
|
cv2.imshow('Item Sorter', output)
|
|
|
|
cv2.imshow('Item Sorter', output)
|
|
|
|
x = 0
|
|
|
|
x = 0
|
|
|
@ -90,7 +92,7 @@ else :
|
|
|
|
valid = True
|
|
|
|
valid = True
|
|
|
|
for item in items:
|
|
|
|
for item in items:
|
|
|
|
if item != itema:
|
|
|
|
if item != itema:
|
|
|
|
print("[ INFO ] More than one object present.")
|
|
|
|
#print("[ INFO ] More than one object present.")
|
|
|
|
valid = False
|
|
|
|
valid = False
|
|
|
|
break
|
|
|
|
break
|
|
|
|
if valid:
|
|
|
|
if valid:
|
|
|
|