Skip to content

Seamless cloning

Algorithm atlasPhotography

Blend a region by solving for pixel values that fit selected image gradients and boundary conditions.

Try it on your image ↓

VISUAL WALKTHROUGHPhotography
REFERENCE INPUTSource patch on a destination

The highlighted region is the part to reconstruct.

RESULTBlend a reconstructed patch

Boundary values constrain the solve while source gradients shape the interior. This illustrates the blend, not a Poisson solution.

STEP 03 / 03

Combine the solved region with the destination image.

Illustrative example. The stages explain the method; they are not a live OpenCV execution.

Try it on an image

YOUR IMAGE · REAL OPENCV

Experiment at pixel level

Open full lab ↗

Clone the rectangle from the second image into the centre of the input. The Poisson solve blends gradients across the mask boundary.

The engine loads on your first run. Your images stay in this browser.

Input448 × 320
OutputWaiting for a result

Scroll over either image to zoom at the pointer. Use the scrollbars to pan both views over the same relative area. Zoom is relative to the input; pixel coordinates belong to each image. Warps can change scene correspondence.

Pixel inspector RGBA · native values · matched scale · 9 × 9 output pixels
Hover to inspect. Click to pin a pixel.
Input
Select a pixel

Output
Select a pixel

Sample models and licenses

When to use it

Insert a patch with smoother boundary appearance or edit illumination inside a selected region.

How it works

  1. 01Choose the source gradients and a destination boundary.
  2. 02Solve a Poisson-style reconstruction inside the mask.
  3. 03Combine the solved region with the destination image.

match interior gradients while respecting boundary values

What to tune

The mask and centre define placement; NORMAL_CLONE and MIXED_CLONE choose different gradient sources.

Where it breaks down

The solution can shift colours to match the destination boundary. It does not guarantee physically consistent lighting or semantics.

TypeScript API

Open an entry for its exact overloads, parameter descriptions, result ownership and pinned upstream source.

All of these calls execute on the CPU. Native objects need explicit disposal. See matrices and ownership and build compatibility.