Image inpainting
Fill a masked region by propagating nearby image structure and colour into it.
The highlighted region is the part to reconstruct.
Mark the pixels to replace.
Advance inward from the known boundary.
The smooth field illustrates continuation into a hole. Texture and larger missing structures are not recovered simply by extending a gradient.
Estimate missing values using the chosen Telea or Navier-Stokes method.
Illustrative example. The stages explain the method; they are not a live OpenCV execution.
Try it on an image
Experiment at pixel level
Remove a rectangular region using surrounding pixels. The selected rectangle is the repair mask.
The engine loads on your first run. Your images stay in this browser.
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
Select a pixel
Select a pixel
When to use it
Remove small scratches or fill narrow missing regions when a plausible continuation is sufficient.
How it works
- 01Mark the pixels to replace.
- 02Advance inward from the known boundary.
- 03Estimate missing values using the chosen Telea or Navier-Stokes method.
known boundary → inward propagation → synthesized fill
What to tune
inpaintRadius controls the local neighbourhood; flags select the algorithm. Keep the mask distinct from observed-data coverage.
Where it breaks down
The result is synthesized. It is not evidence of the original hidden content, especially across large missing objects.
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.
Related methods
Non-local means denoising
Average pixels whose surrounding patches look similar, even when they are not immediate neighbours.
Seamless cloning
Blend a region by solving for pixel values that fit selected image gradients and boundary conditions.
HDR merging and tone mapping
Combine exposure information or fuse well-exposed regions, then map the result into a displayable range.
Panorama stitching
Combine overlapping images through matching, camera estimation, warping and blending.