Selaa lähdekoodia

Drop last polygon points from _compute_polygon_from_points as duplicate

Kentaro Wada 2 vuotta sitten
vanhempi
commit
546445bedd
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      labelme/ai/models/segment_anything.py

+ 1 - 1
labelme/ai/models/segment_anything.py

@@ -186,7 +186,7 @@ def _compute_polygon_from_points(
     polygon = skimage.measure.approximate_polygon(
         coords=contour,
         tolerance=np.ptp(contour, axis=0).max() / 100,
-    )
+    )[:-1]  # drop last point that is duplicate of first point
     if 0:
         image_pil = PIL.Image.fromarray(image)
         imgviz.draw.line_(image_pil, yx=polygon, fill=(0, 255, 0))