My images are always like this:
But I need to rotate them to be like this:
But to do that, I need to find the orientation of the object, knowing
You have to compute the main axis (it is based on PCA). It will give you a good idea of the main orientation, then you can rotate your image accordingly.
As it was pointed as a comment, you now have to test that the thin part is on the right side of the image, and for that you use the centroid/barycenter: if the centroid is on the left of the bounding box, then the wing is well oriented.
Here is the complete algorithm:
Here are the results...