start conversion to support video frames and return a UUID

video
Cole Deck 5 years ago
parent 58b90af9c3
commit 140465d858

@ -169,9 +169,12 @@ for c in cnts:
if pixelsPerMetric is None and circular is True and near(mean_val[0], 16, 4.5): if pixelsPerMetric is None and circular is True and near(mean_val[0], 16, 4.5):
# and near(mean_val[0], 63, 40) is True and near(mean_val[1], 108, 40) is True and near(mean_val[2], 104, 40) is True: # and near(mean_val[0], 63, 40) is True and near(mean_val[1], 108, 40) is True and near(mean_val[2], 104, 40) is True:
pixelsPerMetric = smaller(dA, dB) / args["width"] pixelsPerMetric = smaller(dA, dB) / args["width"]
continue
orig = image.copy() orig = image.copy()
objtype = "Unknown"
objname = ""
# loop over the contours individually # loop over the contours individually
for c in cnts: for c in cnts:
#orig = image.copy() #orig = image.copy()
@ -329,12 +332,16 @@ for c in cnts:
), cv2.FONT_HERSHEY_SIMPLEX, ), cv2.FONT_HERSHEY_SIMPLEX,
0.55, (255, 255, 255), 2) 0.55, (255, 255, 255), 2)
output = "" output = ""
objname = objtype;
if objtype == "Unknown": if objtype == "Unknown":
output = "{:.2f}in".format(itemw) + " x {:.2f}in".format(itemh) output = "{:.2f}in".format(itemw) + " x {:.2f}in".format(itemh)
if objtype == "Screw" or objtype == "Standoff": if objtype == "Screw" or objtype == "Standoff":
output = str(iteml) + "in" output = str(iteml) + "in"
objname += str(iteml)
if objtype == "Axle": if objtype == "Axle":
output = "{:.2f}in".format(iteml) output = "{:.2f}in".format(iteml)
objname += str(itemwr)
print(objname)
if circular: if circular:
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)
@ -348,6 +355,6 @@ for c in cnts:
# show the output image # show the output image
cv2.imshow("Item Sorter", orig) cv2.imshow("Item Sorter", orig)
cv2.waitKey(25) #cv2.waitKey(1)
cv2.waitKey(0) cv2.waitKey(0)

Loading…
Cancel
Save