I want to find medial axis distance transform at middle, fifth pixel at each end point. my input image and desired point are:
Input Image
Desired point on skeleton

My code as follows:
skeleton, distance = medial_axis(cimg, return_distance=True)
med_dist = distance * skeleton
width = med_dist*2
skeld=width[skeleton]
dwidth=skeld[skeld.shape[0]//2]
But it doesn't give correct result
EDIT 0: If you are saying, the skeleton can be any oriented, let's get complicated :). Let me start with a similar problem from my past. There, I needed an approach to track down the pixels between given two points at a skeleton. Please check the accepted answer at the question, and, keep this approach in your mind, because I will use it for your problem too.
Here are the steps that I followed for your problem.
Here are the found tips.
Let's get the path between the found tips by using BFS.
Here are a few more example output from my approach.
In case your skeleton is branched, this approach will give you the indices for all the combinations between the tips.