Skip to content

inpainting_mcfinpainting_mcfInpaintingMcfInpaintingMcfinpainting_mcfinpainting_mcfπŸ”—

Short descriptionπŸ”—

inpainting_mcfinpainting_mcfInpaintingMcfInpaintingMcfinpainting_mcfinpainting_mcf β€” Perform an inpainting by smoothing of level lines.

SignatureπŸ”—

inpainting_mcf( image Image, region Region, out image InpaintedImage, real Sigma, real Theta, integer Iterations )inpainting_mcf( Image, Region : InpaintedImage : Sigma, Theta, Iterations : )void InpaintingMcf( const HObject& Image, const HObject& Region, HObject* InpaintedImage, const HTuple& Sigma, const HTuple& Theta, const HTuple& Iterations )static void HOperatorSet.InpaintingMcf( HObject image, HObject region, out HObject inpaintedImage, HTuple sigma, HTuple theta, HTuple iterations )def inpainting_mcf( image: HObject, region: HObject, sigma: float, theta: float, iterations: int ) -> HObject

Herror inpainting_mcf( const Hobject Image, const Hobject Region, Hobject* InpaintedImage, double Sigma, double Theta, const Hlong Iterations )

Herror T_inpainting_mcf( const Hobject Image, const Hobject Region, Hobject* InpaintedImage, const Htuple Sigma, const Htuple Theta, const Htuple Iterations )

HImage HImage::InpaintingMcf( const HRegion& Region, double Sigma, double Theta, Hlong Iterations ) const

HImage HImage.InpaintingMcf( HRegion region, double sigma, double theta, int iterations )

DescriptionπŸ”—

The operator inpainting_mcfInpaintingMcf extends the image edges that adjoin the region Regionregionregion of the input image Imageimageimage into the interior of Regionregionregion and connects their ends by smoothing the level lines of the gray value function of Imageimageimage.

This happens through the application of the mean curvature flow or intrinsic heat equation

\[\begin{eqnarray*} u_{t} = div(\frac{\nabla u}{|\nabla u|}) |\nabla u| = curv(u) |\nabla u| \end{eqnarray*}\]

on the gray value function \(u\) defined in the region Regionregionregion by the input image Imageimageimage at a time \(t_{0} = 0\). The discretized equation is solved in Iterationsiterationsiterations time steps of length Thetathetatheta, so that the output image InpaintedImageinpaintedImageinpainted_image contains the gray value function at the time \(\textrm{Iterations} \cdot \textrm{Theta}\).

A stationary state of the mean curvature flow equation, which is also the basis of the operator mean_curvature_flowMeanCurvatureFlow, has the special property that the level lines of \(u\) all have the curvature 00. This means that after sufficiently many iterations there are only straight edges left inside the computation area of the output image InpaintedImageinpaintedImageinpainted_image. By this, the structure of objects inside of Regionregionregion can be simplified, while the remaining edges are continuously connected to those of the surrounding image matrix. This allows for a removal of image errors and unwanted objects in the input image, a so called image inpainting, which is only weakly visible to a human beholder since there remain no obvious artifacts or smudges.

To detect the image direction more robustly, in particular on noisy input data, an additional isotropic smoothing step can precede the computation of the gray value gradients. The parameter Sigmasigmasigma determines the magnitude of the smoothing by means of the standard deviation of a corresponding Gaussian convolution kernel, as used in the operator isotropic_diffusionIsotropicDiffusion for isotropic image smoothing.

AttentionπŸ”—

Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on channel level.

ParametersπŸ”—

Imageimageimage (input_object) (multichannel-)image(-array) β†’ object (byte / uint2 / real)object (byte / uint2 / real)HObject (byte / uint2 / real)HImage (byte / uint2 / real)HObject (byte / uint2 / real)Hobject (byte / uint2 / real)

Input image.

Regionregionregion (input_object) region β†’ objectobjectHObjectHRegionHObjectHobject

Inpainting region.

InpaintedImageinpaintedImageinpainted_image (output_object) image(-array) β†’ object (byte / uint2 / real)object (byte / uint2 / real)HObject (byte / uint2 / real)HImage (byte / uint2 / real)HObject (byte / uint2 / real)Hobject * (byte / uint2 / real)

Output image.

Sigmasigmasigma (input_control) real β†’ (real)(real)HTuple (double)HTuple (double)floatHtuple (double)

Smoothing for derivative operator.

Default: 0.50.5
Suggested values: 0.0, 0.1, 0.5, 1.00.0, 0.1, 0.5, 1.0
Restriction: Sigma >= 0

Thetathetatheta (input_control) real β†’ (real)(real)HTuple (double)HTuple (double)floatHtuple (double)

Time step.

Default: 0.50.5
Suggested values: 0.1, 0.2, 0.3, 0.4, 0.50.1, 0.2, 0.3, 0.4, 0.5
Restriction: 0 < Theta <= 0.5

Iterationsiterationsiterations (input_control) integer β†’ (integer)(integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of iterations.

Default: 1010
Suggested values: 1, 5, 10, 20, 50, 100, 5001, 5, 10, 20, 50, 100, 500
Restriction: Iterations >= 1

Combinations with other operatorsπŸ”—

Combinations

Alternatives

harmonic_interpolationHarmonicInterpolation, inpainting_ctInpaintingCt, inpainting_anisoInpaintingAniso, inpainting_cedInpaintingCed, inpainting_textureInpaintingTexture

ReferencesπŸ”—

M. G. Crandall, P. Lions; ``Convergent Difference Schemes for Nonlinear Parabolic Equations and Mean Curvature Motionβ€™β€˜; Numer. Math. 75 pp. 17-41; 1996.

G. Aubert, P. Kornprobst; ``Mathematical Problems in Image Processingβ€™β€˜; Applied Mathematical Sciences 147; Springer, New York; 2002.

ModuleπŸ”—

Foundation