Inpaint

Inpaint[image,region]

retouches parts of image that correspond to nonzero elements in region.

Details and Options

  • Inpaint works with arbitrary grayscale and multichannel images.
  • The region to be retouched can be given as an image, a graphics object, or a matrix.
  • Inpaint always gives an image of the same dimensions and the same type as image.
  • Inpaint operates separately on each color channel.
  • Inpaint takes a Method option that specifies the inpainting method to be used. By default, the "TextureSynthesis" method is used.
  • Possible settings are:
  • "Diffusion"iterative isotropic diffusion method
    "TotalVariation"iterative total variation method
    "FastMarching"fast marching method
    "NavierStokes"NavierStokes method
    "TextureSynthesis"best-fit texture synthesis method using random sampling
  • Inpaint operates separately on each color channel, except with the setting Method->"TextureSynthesis".
  • With Method->{"TotalVariation",subopt}, the following suboptions can be specified:
  • "NoiseModel""Gaussian""Gaussian", "Laplacian", or "Poisson"
    "Regularization"Automaticregularization parameter
  • With Method->{"TextureSynthesis",subopt}, the following suboptions can be specified:
  • MaskingAutomaticbinary mask specifying the pixels to use in finding a best-fit texture
    "MaxSamples"300maximum number of samples used to find the best-fit texture
    "NeighborCount"30number of nearby pixels used for texture comparison
  • Inpaint takes a MaxIterations option that specifies the maximum number of iterations to be performed using the iterative methods. The default setting is MaxIterations->100.

Examples

open allclose all

Basic Examples  (1)

Retouch a crack in a photograph:

In[1]:=
Click for copyable input
Out[1]=

Scope  (2)

Options  (3)

Applications  (6)

See Also

Interpolation  Masking  WienerFilter  TotalVariationFilter  ImagePad  FillingTransform

Introduced in 2010
(8.0)
| Updated in 2015
(10.2)