Skip to main content
2 of 4
deleted 8 characters in body; edited title
LCarvalho
  • 9.3k
  • 5
  • 40
  • 97

How can I create lines using the center of the circles as a reference?

How can I create lines using the center of the circles as a reference?

I created a code, but it generates multiple lines around the circle.

coord=PixelValuePositions[imagem,Red];
coord=Sort@coord;
Graphics[{Line[{{coord[[#,1]],coord[[#,2]]}&/@Range[First[Dimensions[coord]]],{coord[[#,1]],coord[[#,2]]}&/@Range[2,First[Dimensions[coord]]]}]}]

The image used is at the link below:

Image

enter image description here

LCarvalho
  • 9.3k
  • 5
  • 40
  • 97