fffiloni commited on
Commit
7766475
1 Parent(s): fba5b5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -45,11 +45,9 @@ def find_tip(points, convex_hull):
45
  def infer(image_in):
46
  img = cv2.imread(image_in)
47
 
48
- contours, hierarchy = cv2.findContours(preprocess(img), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)
49
- # Filter out only the internal contours (contours with a parent)
50
- internal_contours = [contour for contour, hier in zip(contours, hierarchy[0]) if hier[3] != -1]
51
-
52
- for cnt in internal_contours:
53
  peri = cv2.arcLength(cnt, True)
54
  approx = cv2.approxPolyDP(cnt, 0.025 * peri, True)
55
  hull = cv2.convexHull(approx, returnPoints=False)
 
45
  def infer(image_in):
46
  img = cv2.imread(image_in)
47
 
48
+ contours, hierarchy = cv2.findContours(preprocess(img), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
49
+
50
+ for cnt in contours:
 
 
51
  peri = cv2.arcLength(cnt, True)
52
  approx = cv2.approxPolyDP(cnt, 0.025 * peri, True)
53
  hull = cv2.convexHull(approx, returnPoints=False)