I have to find the shape of the object so i have to find the length of the x and y axis length of the shape. So please help me
You could use bounding box, or MajorAxisLength and MinorAxisLength, which is the axes of an ellipse fitted to the blob. There is no farthest end-to-end measurement available. And there is no definitive crossways width. If you had an elongated, irregularly-shaped blob and the major axis was where you think it would be, then what is the minor axis? The narrowest one? The cross distance at the midpoint (which may be at the widest point, the narrowest point, or something else)?