How to add, principal central axis for a fish, to calculate the length

I’m working on finding the length of the fish, after masking and segmenting the fish using the Segment Anything Model.

I have added contours as well. Now I need to add a center line to calculate the length. This is my image

Can someone help me with this?

Thank you!