How do you define the central axis? A vertical line going through the centroid? Or can it be at some other angle? Please attach your image. Maybe you can simply threshold and call regionprops() and then use find() to go down the binary image and get the left and right distances from the "central axis".