图像拼接方法,用于删除缝合图像的接缝

时间:2016-04-03 14:54:14

标签: image-processing panoramas image-stitching

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

2 个答案:

答案 0 :(得分:2)

I implemented removing of seams for stitching images of eye's retina. Below you can find the final effect:

enter image description here

To do this, I implemented a technique described on page 138 of this paper. Below you can find pseudocode for doing this with explanation, full source can be found on my repository.

Algorithm is based on calculating the final value of pixel by performing weighted average of pixel values of images that are overlapping over this pixel. Weight is based on the distance from the pixel to the edge of the image. If the pixel is closer to the center of the image that it belongs to, then is more important and the weight is bigger. Distance of the pixel to the edge of image can be calculated by using function distanceTransform implemented by OpenCV. This is the effect of distance transform on one of the eye's retina image placed on the final mosaic:

enter image description here

Below you can find pseudocode:

// 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
    }
  }
}

If anything is unclear, write questions in the comments and I will try to improve the answer.

答案 1 :(得分:-2)

你能告诉我你最终得到的解决方案是什么,因为我无法理解,如果我们连接2张图像,我们将如何移除图像中的接缝线,并且我们在两个图像之间得到一条垂直接缝线他们加入的地方。