找到一张图像相对于另一张图像的旋转
我有 2 张图片。一个是参考图像,另一个是参考图像的旋转版本。我想知道第二张图像相对于第一张图像旋转的角度是多少。我想自动执行此操作。
I have 2 images. One is the reference image and the other is the rotated version of the reference image. I would like to find what is the angle by which the 2nd image is rotated wrt 1st one.i want to do this automatically.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
暴力破解吧!编写一个函数来比较旋转图像的交集(每个点之间的差值之和或差值平方和),然后迭代旋转角度以找到与最小差值对应的角度。
虽然知道matlab可能有一个函数只告诉你旋转,但它的名字很奇怪。
Brute-force it! Write a function to compare the intersection of the rotated images (sum of the difference or sum of the difference squared between each point), and then iterate through rotation angles to find the one corresponding to the minimum difference.
Although knowing matlab there's probably a function that just tells you the rotation, but it's called something weird.
执行此操作的一般方法是:
使用诸如 SIFT< 之类的算法/a> 获取兴趣点描述符列表。这些描述符提供了兴趣点的规模、方向和几何形状。几何信息是比例不变和旋转不变的。
使用最近邻算法通过比较几何形状来匹配每张图片中的兴趣点。
对于每对匹配的兴趣点,比较它们的比例和旋转。
理想情况下,所有匹配的兴趣点都将具有相同的相对比例和旋转。然而,图片拍摄方式的可变性和前一阶段的不准确性会引入可变的比例和旋转,因此:
量子电动力学
The general method for doing this is:
Use an algorithm such as SIFT to get a list of interest-point descriptors. These descriptors provide scale, direction and geometry of the interest points. The geometry information is scale- and rotation-invariant.
Use a nearest-neighbor algorithm to match interest points in each of the pictures by comparing geometries.
for each pair of matching interest points, compare their scale and rotation.
Ideally, all of the matching interest points will have the same relative scale and rotation. However, variability in how the pictures were taken and inaccuracy in the previous stages will introduce variable scales and rotations, so:
QED
注意:由于该问题最初并未要求自动化解决方案,因此我发布了此解决方案,该解决方案需要用户为每个图像选择一组控制点。虽然问题中的要求已经更新,但我认为这个答案对于任何想要在 MATLAB 中进行图像配准的人仍然有用,所以我将其留在这里......
非自动化方法:
您所询问的内容称为图像注册,您可以选择使用来自 CP2TFORM 的函数/www.mathworks.com/help/toolbox/images/" rel="nofollow">图像处理工具箱。
事实上,有一个非常好的例子该函数的文档看起来它解决了您试图解决的相同问题。
NOTE: Since the question did not originally ask for an automated solution, I had posted this solution which requires a set of control points to be selected by the user for each image. Although the requirements in the question have been updated, I think this answer could still be useful for anyone wanting to do image registration in MATLAB, so I'm leaving it here...
The non-automated approach:
What you're asking about is known as image registration, and one option you have is to use the function CP2TFORM from the Image Processing Toolbox.
In fact, there's a very nice example in that function's documentation which looks like it tackles the same exact problem you're trying to solve.
这是 如何使用计算机视觉系统工具箱中的局部特征和 RANSAC 恢复两个图像之间的转换的示例。
Here is an example of how to recover a transformation between two images using local features and RANSAC from the Computer Vision System Toolbox.
这是代码。
http://www.mathworks.com/matlabcentral /fileexchange/1713- Three-Dimensional-reconstruction-from-planar-slices
该算法使用两个对象是圆形的先验知识。青年MMV
Here is the code.
http://www.mathworks.com/matlabcentral/fileexchange/1713-three-dimensional-reconstruction-from-planar-slices
This algorithm use apriori knowledge that the two objects are round. YMMV