首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >去除拼接图像接缝的图像拼接方法

去除拼接图像接缝的图像拼接方法
EN

Stack Overflow用户
提问于 2016-04-03 22:54:14
回答 2查看 2.2K关注 0票数 0

我使用SURF进行特征检测,然后使用RANSAC。我得到的拼接图像有接缝。如何删除这些?

EN

回答 2

Stack Overflow用户

发布于 2016-04-05 02:09:32

我实现了去除接缝来缝合眼睛的视网膜图像。下面你可以找到最终的效果:

为此,我实现了this论文的第138页中描述的一种技术。下面你可以找到这样做的伪代码和解释,完整的源代码可以在my repository上找到。

算法的基础是通过对重叠在像素上的图像的像素值执行weighted average来计算像素的最终值。权重基于像素到图像边缘的距离。如果像素越靠近它所属的图像的中心,那么它就越重要,权重也越大。利用OpenCV实现的函数distanceTransform计算像素到图像边缘的距离。这是放置在最终马赛克上的一张眼睛视网膜图像上的距离变换效果:

下面你可以找到伪代码:

代码语言:javascript
复制
// Images is an array of images that the program is stitching

// For every image (after transform) on final plane calculate distance transform
for (image in images) {
  // Calculate distance transform
  image.distanceTransform = distanceTransform(image)
}

// For every pixel in final mosaic, calulate its value by using weighted average
for (row in rows) {
  for (col in cols) {
    currentPixel = FinalMosaic(col, row)

    // Values for weighted average
    numeratorSum = 0
    denominatorSum = 0

    // Go through all images that can overlap at this pixel
    for (image in images) {
      // If image is not overlapping over this pixel just skip
      isOverlapping = image.isOverlapping(currentPixel)
      if (isOverlapping) {
        currentPixelWeight = image.distanceTransform.valueAt(currentPixel)
        numeratorSum += currentPixelWeight * currentPixel.value
        denominatorSum += currentPixelWeight
      }
    }

    if (denominatorSum != 0) {
      currentPixel.value = numeratorSum / denominatorSum
    }
  }
}

如果有任何不清楚的地方,请在评论中写下问题,我会努力改进答案。

票数 2
EN

Stack Overflow用户

发布于 2017-07-10 14:15:48

你能告诉我你最终得到的解决方案是什么吗?因为我不能理解,如果我们连接两个图像,并在两个图像的连接点上得到一条垂直的接缝线,我们将如何去除图像中的接缝线。

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36386968

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档