pytorch-poisson-image-editing
pytorch-poisson-image-editing copied to clipboard
Why is the outside region changed?
Hi @matt-baugh , thanks for your contribution. This blending implementation is super fast.
Here I'd like to seek help from you. Given a source image, a target image, and a mask, we can get the blended image. However, I used blend, and found that there are some slight differences between the target image and the background of blended images. I wonder I have run your code correctly.
if you try cv2.seamlessclone(), you can see similar result. I think this is due to the possion blending editing principle
The mask controls where the gradients are replaced/changed, but because the solution to the optimisation problem (which tries to find the image with the closest matching gradients) it can lead to changes outside the mask area.
This is partially because making changes to the gradients can lead to no exact solution, so the minimal-cost solution ends up being one which slightly changes the area outside the mask.
Maybe it would be possible to avoid this by changing the optimisation problem to prioritise maintaining regions, but currently poisson image editing treats all elements of the image equally.