|
|
@ -151,7 +151,7 @@ for c in cnts:
|
|
|
|
orig = image.copy()
|
|
|
|
orig = image.copy()
|
|
|
|
# loop over the contours individually
|
|
|
|
# loop over the contours individually
|
|
|
|
for c in cnts:
|
|
|
|
for c in cnts:
|
|
|
|
orig = image.copy()
|
|
|
|
#orig = image.copy()
|
|
|
|
num += 1
|
|
|
|
num += 1
|
|
|
|
# if the contour is not sufficiently large, ignore it
|
|
|
|
# if the contour is not sufficiently large, ignore it
|
|
|
|
if cv2.contourArea(c) < 100 or pixelsPerMetric is None:
|
|
|
|
if cv2.contourArea(c) < 100 or pixelsPerMetric is None:
|
|
|
@ -181,10 +181,9 @@ for c in cnts:
|
|
|
|
(blbrX, blbrY) = midpoint(bl, br)
|
|
|
|
(blbrX, blbrY) = midpoint(bl, br)
|
|
|
|
|
|
|
|
|
|
|
|
# compute the midpoint between the top-left and top-right points,
|
|
|
|
# compute the midpoint between the top-left and top-right points,
|
|
|
|
# followed by the midpoint between the top-righ and bottom-right
|
|
|
|
# followed by the midpoint between the top-right and bottom-right
|
|
|
|
(tlblX, tlblY) = midpoint(tl, bl)
|
|
|
|
(tlblX, tlblY) = midpoint(tl, bl)
|
|
|
|
(trbrX, trbrY) = midpoint(tr, br)
|
|
|
|
(trbrX, trbrY) = midpoint(tr, br)
|
|
|
|
|
|
|
|
|
|
|
|
# draw the midpoints on the image
|
|
|
|
# draw the midpoints on the image
|
|
|
|
#cv2.circle(orig, (int(tltrX), int(tltrY)), 5, (255, 0, 0), -1)
|
|
|
|
#cv2.circle(orig, (int(tltrX), int(tltrY)), 5, (255, 0, 0), -1)
|
|
|
|
#cv2.circle(orig, (int(blbrX), int(blbrY)), 5, (255, 0, 0), -1)
|
|
|
|
#cv2.circle(orig, (int(blbrX), int(blbrY)), 5, (255, 0, 0), -1)
|
|
|
@ -290,6 +289,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(500)
|
|
|
|
cv2.waitKey(100)
|
|
|
|
|
|
|
|
|
|
|
|
cv2.waitKey(0)
|
|
|
|
cv2.waitKey(0)
|