Nearest-neighbor fields
PatchMatch completion
Paint out an object and let matching patches from elsewhere in the image fill the gap.
Try it
Runs locally in your browser. Uploaded images stay on your device.
The sample cone is masked already. Add to the coral mask, or clear it and paint another region. Keyboard: focus the source and use arrows to move and paint.


Ready when you are.
Worker processing · local inputs · downloadable output
How it works
The sample cone is masked already. Add to the coral mask, or clear it and paint another region. Keyboard: focus the source and use arrows to move and paint.
- Initialize a random field of candidate patches outside the hole.
- Alternate neighbor propagation with progressively smaller random searches.
- Reconstruct missing pixels from the matched patches and refine, while keeping known pixels unchanged.
Read the original research
Barnes, Shechtman, Finkelstein & Goldman · 2009
Computed examples
Outputs from the same implementation used in the playground.


Source photographs were generated for these studies. The displayed results were computed by the algorithms; they are not generated illustrations of an expected result. Published previews are compressed for the web.
Implementation and limits
A single-image completion loop built around PatchMatch. It can copy texture and nearby structure; it cannot invent a missing object or reconstruct a large unknown scene.
Interactive settings are bounded to keep the experiment practical in a browser. Higher detail can cost more processing time without guaranteeing a better result. The implementation and its tests are available in the source repository.