|
|
|
@ -176,7 +176,7 @@ def detect(calibration_width, img_file, show, quick):
|
|
|
|
|
"""
|
|
|
|
|
pixelsPerMetric = 25
|
|
|
|
|
orig = image.copy()
|
|
|
|
|
objtype = "Unknown"
|
|
|
|
|
objtype = "Object"
|
|
|
|
|
objname = ""
|
|
|
|
|
# loop over the contours individually
|
|
|
|
|
for c in cnts:
|
|
|
|
@ -224,7 +224,7 @@ def detect(calibration_width, img_file, show, quick):
|
|
|
|
|
else:
|
|
|
|
|
circular = True
|
|
|
|
|
cv2.circle(orig, (int(x), int(y)), int(radius), (255, 0, 0), 2)
|
|
|
|
|
objtype = "Unknown"
|
|
|
|
|
objtype = "Object"
|
|
|
|
|
itemw = larger(dimA, dimB)
|
|
|
|
|
itemwr = itemw
|
|
|
|
|
itemwr *= 8
|
|
|
|
@ -306,7 +306,7 @@ def detect(calibration_width, img_file, show, quick):
|
|
|
|
|
# 0.65, (255, 255, 255), 2)
|
|
|
|
|
if objtype != "Penny":
|
|
|
|
|
objtype = magicSort(c)
|
|
|
|
|
if objtype == "Unknown":
|
|
|
|
|
if objtype == "Object":
|
|
|
|
|
objtype = magicSort(c)
|
|
|
|
|
output = "{:.2f}in".format(itemw) + " x {:.2f}in".format(itemh)
|
|
|
|
|
if circular:
|
|
|
|
@ -355,7 +355,7 @@ def magicSort(contour):
|
|
|
|
|
#humoments[6] = abs(humoments[6]) #it's possible for the last number to change sign if item is mirrored
|
|
|
|
|
#magicNumber1 = 0
|
|
|
|
|
#magicNumber2 = 0
|
|
|
|
|
name = "Unknown"
|
|
|
|
|
name = "Object"
|
|
|
|
|
for i in range(0,7):
|
|
|
|
|
if humoments[i] == 0:
|
|
|
|
|
humoments[i] = 0.1;
|
|
|
|
|