OpenCV Major Axis

Hey, I have irregular shapes lets consider an amoeba image and I want to locate and draw the major axis along the input image so how can I?

assuming you have a contour (outline points) already, you can try a PCA or get the minRotatedRect() of the contour (which has an orientation angle)