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

Why is the outside region changed?

Open syguan96 opened this issue 1 year ago • 1 comments
trafficstars

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.

syguan96 avatar Oct 24 '24 09:10 syguan96

if you try cv2.seamlessclone(), you can see similar result. I think this is due to the possion blending editing principle

ZZQ987 avatar Feb 27 '25 14:02 ZZQ987

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.

matt-baugh avatar Jun 20 '25 16:06 matt-baugh