问题描述
您好,已经看到了很多教程如何使用两张照片做简单的图像拼接,这没有问题。
但是当我想从4-6张图片或更多的图片制作一个全景?
Hi have seen a lot of tutorials how to do simple image stitching using two photos and that is no problem.
But what to do when I want to make a panorama from 4-6 images or more?
我有代码,它接收图像文件列表(图像是从序列中的第一个图像到最后一个图像的顺序)。然后对于每个图像,我计算SIFT特征描述符
。但是,然后我被卡住了,对于两个图像,我将使用FLANN kd-tree设置一个匹配器,并找到图像之间的匹配和计算同位素。与本教程类似,
I have code that takes in list of image files(the images are in order from the first image in the sequence to the last). Then for each image I compute the SIFT feature descriptors. But then I am stuck, for two images I would set up a matcher using FLANN kd-tree and find matches between the images and calculate the Homography. Similar to this tutorial http://docs.opencv.org/trunk/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.html#py-feature-homography
但不是显示特征点之间的线end我已使用此功能从2张图片制作全景图。但我不知道当我要将第三张和第四张图片添加到全景图片时该怎么做。
But in stead of showing the lines between feature points at the end I have used this http://stackoverflow.com/a/20355545/622194 function to make a panorama from 2 images. But I am not sure what to do when I want to add the third and the fourth image to the panorama.
编辑:
从我的答案,我试图实现我的图像拼接脚本来计算图像之间的图像之间的单数矩阵,在图像序列中彼此相邻。所以如果我有I1 I2 I3和I4我现在有H_12,H_23和H_34。然后我从使用H_12缝合I1和I2开始。然后,我想找到累积单应性来将I3拼接到当前全景。 I fing H_13 = H_12 * H_23并将图像3缝合到当前全景,但是在这里我在全景图像中得到非常明显的间隙,当下一个图像被缝合时,它是更大的间隙,图像非常拉伸。这是我的代码
From the answers I have tried to implement my image stitching script to calculate a homography matrix between images that are next to each other in the image sequence. So if I have I1 I2 I3 and I4 I now have H_12, H_23 and H_34. Then I start by stitching I1 and I2 using H_12. Then I want to find cumulative homography to stitch I3 to the current panorama. I fing H_13 = H_12*H_23 and stitch the image 3 to the current panorama but here I get very apparent gap in my panorama image and when next image is stitched it is even bigger gap and the images is very stretched. Here is my code http://pastebin.com/dQjhE5VD
任何人告诉我,如果我正在使用正确的方法,或者有人发现错误或看到我做错了。
Can anyone tell me if I am using right approach for this or can someone spot the error or see what I am doing wrong.
推荐答案
一步一步,假设你要缝合四个图像I0,I1,I2,I3,你的目标是计算单应性H_0,H_1,H_2,H_3;
Step by step, assuming you want to stitch four images I0,I1,I2,I3, your goal is to compute homographies H_0,H_1,H_2,H_3;
- 计算所有成对的单应性H_01,H_02,H_03,H_12,H_13,H_23 I0 into I1,etc ...
- 选择一个锚图像例如I1,其位置将保持固定,即H_1 =身份
- 根据
的最大数量找到更好地与I1对齐的图像。 I3 - 更新H_3 = H_1 * inv(H_13)= inv(H_13)= H_31
- 找出更符合I1或I3的图片I3
- 更新H_2 = H_3 * H_23
- 与图片I0相同
- 全局优化对齐
- Compute all pairwise homographies H_01,H_02,H_03,H_12,H_13,H_23 where homography H_01 warps image I0 into I1, etc...
- Select one anchor image e.g. I1 which position will remain fixed i.e H_1=Identity
- Find image that better align with I1 based on maximum number ofconsistent matches e.g. I3
- Update H_3= H_1 * inv(H_13) = inv(H_13) = H_31
- Find image that better matches I1 or I3 e.g I2 matching I3
- Update H_2= H_3 * H_23
- Same as above for image I0
- Do bundle adjustment to globally optimize alignment
请参阅本论文的第4部分了解详情。
See section 4 of this seminal paper https://www.cs.bath.ac.uk/brown/papers/ijcv2007.pdf for an in depth explanation.
这篇关于使用OpenCV(Python)拼接多个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!