Is there any method to find medial axis distance at middle, and fifth pixel of end points of skeleton medial axis?

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

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

and who defined that medial_axis function?

@crackwitz python has function on skimage library.

from skimage.morphology import medial_axis

My task is to find medial axis distance at mid point, and 5 pixel ahead of end points of skeleton.