I have a distribution of points, and the same distribution rotated by an unknown amount. I want to estimate the rotation between the distributions and correct for it.
I have tried the following function which is able to align vectors.
# adding a third dimension as the function below (Rotation.align_vectors()) uses 3D vectors to calculate the rotation. By adding a 3D dimension of all 0, we basically are still in 2D space.
df['dimension'] = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
df_rot['dimension'] = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
# this function here is important, this is where the rotation is calculated. The output of a is what we need to adjust for the rotation. By taking PI and deviding it by the output value of the function we can rotate the image back to its origional position and thus adjust for any rotation of agar.
from scipy.spatial.transform import Rotation
a,b = Rotation.align_vectors(df_rot,df)
But the rotation parameters are insufficient to correct for the rotation (I use the following function to rotate my images (Rotate point about another point in degrees python).
How would I figure out the rotation of my image?
Edit:
The centre of rotation is always in the middle (50,50 in this plot).