【问题标题】:How to stitch multiple images that are in a random order using OpenCV in python?如何在python中使用OpenCV拼接多个随机顺序的图像?
【发布时间】:2018-06-25 16:57:32
【问题描述】:

在 python 中使用 OpenCV,我试图拼接多个乱序的图像。我有一个有效的缝合方法,可以缝合两个图像,给定左右一个。

    def stitch(self, images, ratio=0.75, reprojThresh=4.0, 
    showMatches=False):

    """
    This function performs image stitching with help of other member functions of Stitcher class.
    Args:
        images          (list)  :   List of two images ordered left to right 
        ratio           (float) :   Ratio for Lowe's Test
        reprojThresh    (float) :   reprojThresh parameter for RANSAC for homography computation
        showMatches     (bool)  :   Flag for marking showing matches on input images
    """

    (imageL, imageR) = images

    #Find key points and features for input images
    (kpsR, featuresR) = self.find_kp_features(imageR)
    (kpsL, featuresL) = self.find_kp_features(imageL)

    # Match features between two input images
    M = self.matchKeypoints(kpsR, kpsL, featuresR, featuresL, ratio, reprojThresh)

    if M is None:
        return None


    (matches, H, status) = M
    #Perform perspective correction on second image (imageR)
    result = cv2.warpPerspective(imageR, H, (imageR.shape[1] + imageL.shape[1], imageR.shape[0]))

    #Insert Left image (imageL) in result to obtai stitched image
    result[0:imageL.shape[0], 0:imageL.shape[1]] = imageL

    if showMatches:
        vis = self.drawMatches(imageR, imageL, kpsR, kpsL, matches,
            status)

        return (result, vis)

    return result

来源:https://github.com/TejasBob/Panorama/blob/master/image-stitching-report.pdf

我已阅读以下paper,但我仍然对将多张随机顺序的图像拼接在一起的方法感到困惑。我考虑过使用捆绑调整算法,但我不知道可能的实现。

我的问题是将多个无序的图像拼接在一起的最佳方法是什么?我能做的一些合适的材料或伪代码也会有所帮助。

【问题讨论】:

  • 你说的'我修好了'是什么意思?你能分享你的方法吗?
  • 对不起,这是对版主评论的回应。我还没有找到解决方案。如果您有任何想法,请告诉我。
  • THIS BLOG可以帮到你!!

标签: python opencv image-processing computer-vision image-stitching


【解决方案1】:

对于以随机顺序拼接的多张图像,您可以尝试以下操作:

1)在一张图片中找到特征

2) 尝试匹配所有图像中的这些特征

3) 选择与初始图像最大匹配的图像并执行拼接

4) 现在您有了一个新的拼接图像,您可以在其中添加特征并在其他帧中再次匹配它们等等。

这会很耗时,但可以考虑这个方向。

【讨论】:

  • 谢谢,但您能否提供此过程的 sn-p 代码?
猜你喜欢
  • 1970-01-01
  • 2023-03-17
  • 2020-03-10
  • 1970-01-01
  • 2011-12-26
  • 2012-12-01
  • 2012-01-02
  • 1970-01-01
  • 2021-10-03
相关资源
最近更新 更多