# Mid-point of worm-like objects

I have a video of worm-like objects which move. They can move in a straight line, they can rotate in circles, they can move in a serpentine/winding/sinuous way. I need to track them.

I already have all the necessary code to track them by finding their contours so I have all the "topological" information necessary however there is one last thing I am not able to do so far: finding their center.

What I mean by center is of course not the center of mass or of gravity or of simmetry, but rather the mid-point, the center along the line that goes from head to tail.

I need it because if the worm rotates or steers, the center-of-mass does not move much but the mid-point of the worm is actually moving.

Does abybody have any suggestion?

Here an example of the kind of images we are dealing with:

• What an interesting problem! Are they always going to be just a couple of pixels wide, like your example? What level of accuracy is required, is being off by one or two pixels close enough? Mar 22, 2018 at 11:29
• Are you able to determine which are the two end points? Mar 22, 2018 at 20:24
• They won't be much wider than that, not more than 5 pixels. Accuracy is not a big problem... I have the contour of the object i.e. the coordinates of the border and of the points inside. I can't Think of and smart way to find the two ends right now but in principle it should be possible Mar 23, 2018 at 7:43