在 Python 中使用 SVD 旋转图像

Rotate image using SVD in Python

我想拍几张矩形房间的旋转图像,例如 this and rotate them such that the long side of the room is parallel to the x-axis like this 在 Python 中。朋友推荐使用SVD,据我了解我需要使用Numpy或SciPy SVD,找到图像与x轴之间的角度差,并根据角度差旋转图像。我对 SVD 不是很了解,拿到 SVD 后我该怎么做?

如有任何帮助,我们将不胜感激。谢谢!

SVD 类似于 PCA,它会在您的数据中找到 "natural" 轴(阅读维基百科或任何其他 doco 以更严格地解释 "natural" 的含义)。 SVD 返回的 U 矩阵是您之后的旋转矩阵(即数据的原始 x-y 轴与 SVD 找到的 "natural" 轴之间)。