0

I have used SURF for feature detection and then I have used RANSAC. The stitched image I got has seams. How do I remove these?

user6053898
  • 11
  • 1
  • 3

2 Answers2

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.

Aleksander Grzyb
  • 749
  • 1
  • 6
  • 18
-2

Could you please tell what was the solution you got eventually as I couldn't understand how will we be removing the seam line in the image if we join 2 images and we get a single vertical seam line between two images at the point where they are joining.