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)