Every smartphone photo editor has a button that lets you lift an object from one photo and drop it into another. When the result looks fake, the reason is almost always the same: the colors at the boundary of the pasted region clash with the background.
The naive fix — blending a few pixels at the edge — blurs fine detail and rarely looks convincing. The elegant fix, published by Patrick Pérez, Michel Gangnet, and Andrew Blake at SIGGRAPH 2003, replaces the question entirely: instead of asking what color should each pixel be, it asks what gradient should each pixel have.
A gradient is simply the rate and direction of color change — the texture information humans actually see. Preserve the source gradient everywhere inside the pasted region, match the destination colors exactly on the boundary, and the result is a unique solution that blends naturally by design.
Finding that solution requires solving Poisson's equation — the same equation used in electrostatics, heat flow, and fluid simulation — but applied pixel by pixel over the pasted region.
Comments
Loading comments...