I have some ordered scatter points that, according to their index values, can be connected into a closed loop.Now I want to get the center line of this loop. I have tried two algorithms, one based on Voronoi graphs and one based on graphics. For the Voronoi algorithm, I used the algorithm of https://github.com/fitodic/centerline. Here is the resurlt of the Voronoi graphs.
But there are branches at the tip,like this:
Another method is based on graphics, I define the outline as white inside and black outside, like this
I used skimage.morphology to get the skeleton.
skeleton = medial_axis(binary_image).astype(np.uint8) * 255
But from the results, the effect is not as good as the first algorithm.
Is there any good way to extract the midline of this outline?
The definition of a middle arc looks like this
--------------------Renewal------------------
I found a problem similar to mine, but I didn't know how he removed the branches and connected the midpoints. How do I draw a line along the center of the object
And another problem, but his solution seems less precise. python cv2 draw a center curve in a curved object
Very simple idea (based on graphics):
Divide the white region to several sub-regions (along to long direction of the white region), then calculate "center"(center of gravity or some other) position of each sub-regions. Finally, connect these( as a poly-line or spline, etc).