|
@@ -6,7 +6,8 @@ cv2.namedWindow('Image', cv2.WINDOW_NORMAL)
|
|
|
def chose(contour):
|
|
|
sm = cv2.arcLength(contour, True)
|
|
|
approx = cv2.approxPolyDP(contour, sm*0.025, True)
|
|
|
- if len(approx) == 8: return 'circle'
|
|
|
+ print(approx)
|
|
|
+ if len(approx) == 7 or len(approx) == 8: return 'circle'
|
|
|
|
|
|
|
|
|
def recognize(image):
|
|
@@ -18,7 +19,7 @@ def recognize(image):
|
|
|
contours = cv2.findContours(binary.astype('uint8'), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)[0]
|
|
|
for i,contour in enumerate(contours):
|
|
|
# print(contour)
|
|
|
- print(chose(contour))
|
|
|
+ # print(chose(contour))
|
|
|
if chose(contour) == 'circle':
|
|
|
cv2.drawContours(image, contours, i, (0, 255, 0), 10)
|
|
|
|