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