简体   繁体   English

在Python中使用SVD旋转图像

[英]Rotate image using SVD in Python

I would like to take several rotated images of a rectangular room like this and rotate them such that the long side of the room is parallel to the x-axis like this in Python. 我想利用矩形室的几个旋转图像像这样并且这种旋转它们,房间的长边平行于像X轴在Python。 A friend recommended using SVD, and from what I understand I need to use the Numpy or SciPy SVD, find the angle difference between the image and the x-axis, and rotate the image by the angle difference. 一位朋友建议使用SVD,据我所知,我需要使用Numpy或SciPy SVD,找到图像和x轴之间的角度差,然后按角度差旋转图像。 I do not fully understand SVD, so what do I do once I have gotten the SVD? 我不完全了解SVD,因此一旦获得SVD,我该怎么办?

Any help would be appreciated. 任何帮助,将不胜感激。 Thank you! 谢谢!

SVD is similar to PCA, it will find the "natural" axes in your data (read wikipedia or any other doco for more rigorous explanation of what "natural" means). SVD与PCA相似,它将在您的数据中找到“自然”轴(请阅读Wikipedia或任何其他文档,以更严格地解释“自然”的含义)。 The U matrix returned by SVD is the rotation matrix you are after (that is between the original xy axis of your data, and the "natural" axes found by SVD). SVD返回的U矩阵是您要使用的旋转矩阵(位于数据的原始xy轴和SVD找到的“自然”轴之间)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM