Skip to content
Advertisement

Multi band blending makes seams brighter and more visible

I’m trying to stitch two pre-warped images together seamlessly using multi-band blending. I have two input images (that have already been warped) and one mask. However, when I apply MBB, the area surrounding the seams glow brighter and as a result, they become more visible which is the opposite of the objective here. I have absolutely no idea what I’m doing wrong.

To better explain the problem, here are the images and the output:

Target:Target (B)

Source:Source (A)

Mask:Mask (M)

And once I blend the source image into the target, this is what I get:

output

Here’s my code for reference:

JavaScript

Canvas to pass to the function (basically the mask for the target/mosaic):Canvas to pass to the function

Mask for the source/new image:Mask for the source/new image

I’m also open to exploring other ways to blend the two images seamlessly, in case MBB is not the most suitable method to achieve my goal. Please help.

Advertisement

Answer

here’s a C++ answer, but the algorithm is easy.

JavaScript

The general idea is to measure the distance from the mask border to the inside and assume that pixels at the border have less quality (more likely will lead to seams), so blending should be stronger for those pixels.

This would probably be even better if you measure (or even precompute) this distance before warping the mask to the mosaic canvas.

When using these masks

enter image description here

enter image description here

I get this result:

enter image description here

as you can see there is still a seam but that’s from the intermediate mosaic (one of the input images) and it wouldnt be present if previous stitching was performed with the same blending.

Then using this mask for the intermediate mosaic (telling that the already given seams have low pixel quality)

enter image description here

I get this result:

enter image description here

Best would be to compose the mosaic blending mask by using the per pixel maximum value of the previous blending mask and the new image blending mask.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement