mumok4 11 mesiacov pred
rodič
commit
0e6429c2eb
2 zmenil súbory, kde vykonal 3 pridanie a 2 odobranie
  1. 3 2
      falling_ball/cv.py
  2. BIN
      falling_ball/image.png

+ 3 - 2
falling_ball/cv.py

@@ -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)
 

BIN
falling_ball/image.png