add sorting code, saving to file

video
Cole Deck 4 years ago
parent e21628b608
commit bcfd61a7cf

Binary file not shown.

Binary file not shown.

Binary file not shown.

6558
detect.c

File diff suppressed because it is too large Load Diff

@ -1,4 +1,5 @@
import detect
import sort
import timeit
import cv2
from imutils.video import FPS
@ -22,6 +23,7 @@ def go():
break
if valid:
print("Found " + itema)
bin = sort.sort(itema)
if not video:
elapsed_time = timeit.timeit(go, number=1)/1

@ -0,0 +1,31 @@
# Sort items
import pickle
def write(bins):
file = open("bins.txt","w+b")
pickle.dump(bins, file)
file.close()
def sort(input):
file = open("bins.txt","a+b")
file.close()
file = open("bins.txt", "rb")
bins = pickle.load(file)
if len(bins) == 0:
bins = ['Unknown']
file.close()
write(bins)
#file.write(str(bins))
if bins.count(input) == 0:
bins.append(input)
bin = bins.index(input)
print(str(bins))
print(bin)
write(bins)
return bin
def clear():
write(["Unknown"])
write(["Unknown"])
Loading…
Cancel
Save