|
@@ -15,15 +15,16 @@ def recognize(image):
|
|
|
|
|
|
binary[np.any(hsv > 190, axis=2)] = 1
|
|
|
|
|
|
- cv2.imshow('Image', binary)
|
|
|
-
|
|
|
+ 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))
|
|
|
+ if chose(contour) == 'circle':
|
|
|
+ cv2.drawContours(image, contours, i, (0, 255, 0), 10)
|
|
|
+
|
|
|
+ cv2.imshow('Image', image)
|
|
|
while cv2.waitKey(1) != ord('q'): continue
|
|
|
|
|
|
- labels, labeledScreen = cv2.connectedComponents(binary)
|
|
|
- cnts, hierrache = cv2.findContours(labels, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)
|
|
|
- for label in labels:
|
|
|
- print(chose(label))
|
|
|
-
|
|
|
# image = image[t_min_loc1[1] + 20:t_min_loc2[1], t_min_loc1[0] + 20:t_min_loc2[0]]
|
|
|
|
|
|
# hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
|