I have a binary image of a worm (blob extraction which works well). I am interested in fitting a centerline on the blob (worm).
So far I came up with this: starting from a polygon (after outline extraction of blob in the image) I applied a voronoi computation and discarded all vertices which are outside of the polygon (blue) which gave me the black center line which I can further use to fit a smooth centerline.
However, this computation is not at all robust (due removing voronoi vertices not inside the polygon?) Does somebody know an algorithmic workflow to get the centerline of a polygon or the center line of a blob object (binary image). (skeletonization?, triangulation of polygon an using midpoints of inside edges)
Here is a demonstration:
I have found a better solution:
If someone is interested in the solution, I may share a python notebook. end result: green= final midline graph, dark green=final midline
the graph of the skelton
Source Code:
The code to this question can be found here: https://github.com/gabyx/WormAnalysis (if you use it please star it)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With