How to interpret skimage orientation to straighten images? I have a bunch of images that I am trying to straighten so the images are horizontal (major axis is horizontal) but I don't understand the orientation output from regionprops method in skimage. How to convert it into degrees ? What is the axis reference for the output angle ?
Here is the skimage doc:

orientation : float. Angle between the 0th axis (rows) and the major axis
of the ellipse that has the same second moments as the region, ranging
from -pi/2 to pi/2 counter-clockwise.

My question:
Given the orientation, how do I calculate the angle in degrees to rotate the image so that the major axis is horizontal with skimage?
Code sample
Basically, the main major and minor axis of this object belong to index 1 of the pandas dataframe. The orientation of the object is -1.184075 and should belong to the major axis.
from skimage.measure import label, regionprops_table

# connected pixels of same label get assigned a value
label_img = label(binary_image_here)
props = regionprops_table(label_img, properties=('centroid',
                                             'bbox',
                                             'orientation',
                                             'major_axis_length',
                                             'minor_axis_length'))

df = pd.DataFrame(props)
Based on the doc you provide, orientation is in radians, ranging from -pi/2 to pi/2 counter-clockwise:

orientation : float. Angle between the 0th axis (rows) and the major
axis of the ellipse that has the same second moments as the region,
ranging from -pi/2 to pi/2 counter-clockwise.

Moreover, as it is said in the regionpropos doc, since 0.16.0, they use &quot;rc&quot; corrdinates everywhere. They say for the majority of computation you could find the old results with a simple transformation, but for others, it is more complicated, such as the orientation:

For example, the new orientation is π/2 plus the old orientation.

Which means that the right formula to get the angle you want is this one:
angle_in_degrees = orientation * (180/np.pi) + 90 

And the orientation refers to this angle on the image:

Now: If you want your major axis and the 0th axis align, then rotate your image by -angle_in_degrees:
from skimage.transform import rotate
rotate(image, -angle_in_degrees, resize=True)