NaturalIntelligence / imglab

To speedup and simplify image labeling/ annotation process with multiple supported formats.
https://solothought.com/imglab/
MIT License
985 stars 609 forks source link

svg.js: fix: polygon with duplicate points #32

Closed amitguptagwl closed 6 years ago

amitguptagwl commented 6 years ago

starting point: v2.html link: https://naturalintelligence.github.io/imglab/v2.html

Steps:

  1. Open the link above.
  2. Load images into gallery
  3. select an image to load into workareas.
  4. select polygon tool
  5. press F12 to inspect "myCanvas" svg
  6. draw polygon. You'll see the element being created in DOM with 2 points on every click (sometime one point).
<polygon id="SvgjsPolygon1063" points="179,177 179,177 397,147 323,381 323,381 88,350 88,350" class="labelbox shape"></polygon>
  1. Delete repeated points manually from the DOM element. Now resize or move the polygon, you'll notice that duplicate points re-appear.

In case of 3 points (triangle) polygon, total points are 5. In case of 4 points polygon, total points are 7. In case of 5 points polygon, total points are 8.