`inpainting_aniso`

— Perform an inpainting by anisotropic diffusion.

**inpainting_aniso**(*Image*, *Region* : *InpaintedImage* : *Mode*, *Contrast*, *Theta*, *Iterations*, *Rho* : )

The operator `inpainting_aniso`

uses the anisotropic diffusion
according to the model of Perona and Malik, to continue image edges
that cross the border of the region * Region* and to connect
them inside of

`Region`

With this, the structure of the edges in * Region* will be
made consistent with the surrounding image matrix, so that an
occlusion of errors or unwanted objects in the input image, a so
called inpainting, is less visible to the human beholder, since
there remain no obvious artefacts or smudges.

Considering the image as a gray value function u, the algorithm is
a discretization of the partial differential equation
with the initial value defined by
* Image* at a time . The equation is
iterated

`Iterations`

`Theta`

`InpaintedImage`

`Iterations`

`Theta`

The primary goal of the anisotropic diffusion, which is also
referred to as nonlinear isotropic diffusion, is the elimination of
image noise in constant image patches while preserving the edges in
the image. The distinction between edges and constant patches is
achieved using the threshold * Contrast* on the magnitude of
the gray value differences between adjacent
pixels.

`Contrast`

`Region`

`Rho`

The algorithm used is basically the same as in the anisotropic
diffusion filter `anisotropic_diffusion`

, except that here,
border treatment is not done by mirroring the gray values at the
border of * Region*. Instead, this procedure is only
applicable on regions that keep a distance of at least 3 pixels to
the border of the image matrix of

`Image`

`Region`

`Region`

`Image`

`Region`

`Region`

The result of the diffusion process depends on the gray values in
the computation area of the input image * Image*. It must be
pointed out that already existing image edges are preserved within

`Region`

`Region`

`harmonic_interpolation`

first to remove all unwanted edges
inside the computation area and to minimize the gray value
difference between adjacent pixels, unless the input image already
contains information inside `Region`

The variable diffusion coefficient g can be chosen to follow
different monotonically decreasing functions with values between
*0* and *1* and determines the response of the
diffusion process to an edge. With the parameter * Mode*, the
following functions can be selected:
Choosing the function by setting

`Mode`

`Theta`

`Mode`

`Mode`

Furthermore, the choice of the value *'shock'* is possible
for * Mode* to select a contrast invariant modification of the
anisotropic diffusion. In this variant, the generation of edges is
not achieved by variation of the diffusion coefficient g, but the
constant coefficient g=1 and thus isotropic diffusion is
used. Additionally, a shock filter of type
is applied, which, just like a negative diffusion coefficient,
causes a sharpening of the edges, but works independent of the
absolute value of . In this mode,

`Contrast`

`isotropic_diffusion`

. The parameter is scaled in
such a way that diffusion and sharpening cancel each other out for
`Contrast`

`Contrast`

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.

- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
- Automatically parallelized on channel level.

`Image`

`→`

object (byte / uint2 / real)
Input image.

`Region`

`→`

object
Inpainting region.

`InpaintedImage`

`→`

object (byte / uint2 / real)
Output image.

`Mode`

`→`

(string)
Type of edge sharpening algorithm.

Default value: 'weickert'

List of values: 'parabolic' , 'perona-malik' , 'shock' , 'weickert'

`Contrast`

`→`

(real)
Contrast parameter.

Default value: 5.0

Suggested values: 0.5, 2.0, 5.0, 10.0, 20.0, 50.0, 100.0

Restriction: `Contrast > 0`

`Theta`

`→`

(real)
Step size.

Default value: 0.5

Suggested values: 0.5, 1.0, 5.0, 10.0, 30.0, 100.0

Restriction: `Theta > 0`

`Iterations`

`→`

(integer)
Number of iterations.

Default value: 10

Suggested values: 1, 3, 10, 100, 500

Restriction: `Iterations >= 1`

`Rho`

`→`

(real)
Smoothing coefficient for edge information.

Default value: 3.0

Suggested values: 0.0, 0.1, 0.5, 1.0, 3.0, 10.0

Restriction: `Rho >= 0`

read_image (Image, 'fabrik') gen_rectangle1 (Rectangle, 270, 180, 320, 230) harmonic_interpolation (Image, Rectangle, InpaintedImage, 0.01) inpainting_aniso (InpaintedImage, Rectangle, InpaintedImage2, \ 'perona-malik', 5.0, 100, 50, 0.5) dev_display(InpaintedImage2)

`harmonic_interpolation`

,
`inpainting_ct`

,
`inpainting_mcf`

,
`inpainting_texture`

,
`inpainting_ced`

J. Weickert; “Anisotropic Diffusion in Image Processing”; PhD
Thesis; Fachbereich Mathematik, Universität Kaiserslautern; 1996.

P. Perona, J. Malik; “Scale-space and edge detection using
anisotropic diffusion”; Transactions on Pattern Analysis and
Machine Intelligence 12(7), pp. 629-639; IEEE; 1990.

G. Aubert, P. Kornprobst; “Mathematical Problems in Image
Processing”; Applied Mathematical Sciences 147; Springer, New
York; 2002.

Foundation