pytorch-poisson-image-editing icon indicating copy to clipboard operation
pytorch-poisson-image-editing copied to clipboard

Color artifacts when mask reaches boundaries

Open YotamNitzan opened this issue 1 year ago • 3 comments

Thanks for sharing this repository!

The blended result often has some color artifacts when the mask reaches the image's boundary. For exmaple - (src,dst, and mask resized for readability. Everything at 1024x1024 originally).

Source Target Mask
src dst mask

Result: out-fullres

The result image has faded yellow and blue "color artifacts" near the right and left image boundaries. At least for the right side, I'm assuming it might be caused by lack of accurate boundary conditions. But on the other hand, some cases where the mask reaches the boundary are fine...

Do you have a suggestion for solving this issue? Thanks!

YotamNitzan avatar Jan 06 '24 14:01 YotamNitzan

Hmm not sure exactly, which implementation are you using (Green's function or DST)? From the result I also assume you're using mixed_gradients, but a code snipped would help to clarify what you're running here.

matt-baugh avatar Jan 12 '24 16:01 matt-baugh

I found some color artifacts that I solved clampling the blended result in the range 0 to 1

conti3000 avatar Jan 25 '24 20:01 conti3000

Ah yes if you are using images with a specific value range it is often helpful to wrap any call to the blend function with a clipping function that uses the min/max values of that range. This is not part of the library as it is specific to the type of images being blended, but I would definitely recommend it if you are working with natural images (encoded as 0-1, if they are 0-255 you should clip with those values instead).

matt-baugh avatar Jan 29 '24 10:01 matt-baugh