I had a question about the implementation of scipy's ndimage.rotate method, specifically relating to the way it actually works when rotating an array by an arbitrary amount, and whether it preserves the numbers contained within the array?
I am attempting to find a way to rotate some arrays whilst also preserving the numbers in the array and not loosing any information.
I have attempted to test it by initializing some arrays with known shapes inside it, but I have noticed that if you initialize some specific shapes, such as crosses, then when you rotate by a certain amount, the cross will become a square, and I am concerned that I am loosing information here.
matr_1= [[0, 1, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 1, 1, 1],
[0, 0, 0, 0, 1, 0]]
matr_2= [[0, 0, 1, 0, 0, 0],
[0, 1, 1, 1, 0, 0],
[0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 1, 1, 1],
[0, 0, 0, 0, 1, 0]]
plt.imshow(matr_1)
plt.show()
print("Rotation by 45 degrees")
print(sp.ndimage.rotate(matr_1, 45, reshape=False))
plt.imshow(sp.ndimage.rotate(matr_1,45,reshape=False))
plt.show()
print("Rotation by 55 degrees")
print(sp.ndimage.rotate(matr_2, 90, reshape=False))
plt.imshow(sp.ndimage.rotate(matr_1,90,reshape=False))
I understand that this might be an issue inherent to all rotation algorithms, but I want to understand what operations are actually being applied to the arrays.