← all work classical-computer-vision

Poisson blending

[![Python 3.10+](https://img.shields.io/badge/python-3.10+-3776AB?logo=python&logoColor=white)](https://www.python.org/)

Result

SrPairCopy-pasteAlpha featherPoisson (OpenCV)Mixed gradientsJacobi (from scratch)
1bird in a meadow + snowshoes on snow1.7900.760**0.543**0.5330.623
2tent on the ice + bobcat and daisies1.626**0.700**0.8850.8230.842
3wallaby in scrub + spear fisher4.519**1.179**1.2860.8661.207
4stone viaduct + skier mid air4.7581.148**1.091**0.8361.022

The finding

The equation, solved twice

` minimise |∇f − ∇source|² inside the region subject to f = target on the boundary `

whose solution satisfies ∇²f = ∇²source. Discretised, every interior pixel is the average of its four neighbours minus the source's Laplacian, so iterating that update converges to the answer.

They agree to 0.0066 — two independent implementations of the same equation, which is the only real check that either is right — and the transparent one costs 38× the time.

Converged by 50 iterations and flat thereafter; the slight rise past 200 is float accumulation in the Jacobi update, not further progress.

### The one line that makes it Poisson blending

`python f = sub.copy() # target everywhere, INCLUDING the boundary ring f[interior] = patch[interior] # a starting guess, interior only `

Seeding the boundary from the source instead — f[region_mask] = patch[...] — makes f = source an exact fixed point of the iteration, because the solution of ∇²f = ∇²g with f = g on the boundary *is* g.

The solver then "converged" in zero steps to the copy-paste answer and reported a seam visibility of **2.8046 — identical to the control, to four decimal places** — with nothing at all to indicate it had not run. It is the quietest failure in this repository: a method that is a no-op, reporting a plausible number, in a table where another row happens to carry the same one.

---

Figures

blends.png
blends

Elsewhere

Code and full results on GitHub (code private)

Every number is read from the file the run produced. github.com/hammasbuilds · kaggle.com/muhammadhammas13