ClassesClasses | | Operators

inpainting_textureinpainting_textureInpaintingTextureInpaintingTexture (Operator)

Name

inpainting_textureinpainting_textureInpaintingTextureInpaintingTexture — Perform an inpainting by texture propagation.

Signature

inpainting_texture(Image, Region : InpaintedImage : MaskSize, SearchSize, Anisotropy, PostIteration, Smoothness : )

Herror inpainting_texture(const Hobject Image, const Hobject Region, Hobject* InpaintedImage, const Hlong MaskSize, const Hlong SearchSize, double Anisotropy, const char* PostIteration, double Smoothness)

Herror T_inpainting_texture(const Hobject Image, const Hobject Region, Hobject* InpaintedImage, const Htuple MaskSize, const Htuple SearchSize, const Htuple Anisotropy, const Htuple PostIteration, const Htuple Smoothness)

void InpaintingTexture(const HObject& Image, const HObject& Region, HObject* InpaintedImage, const HTuple& MaskSize, const HTuple& SearchSize, const HTuple& Anisotropy, const HTuple& PostIteration, const HTuple& Smoothness)

HImage HImage::InpaintingTexture(const HRegion& Region, Hlong MaskSize, Hlong SearchSize, double Anisotropy, const HString& PostIteration, double Smoothness) const

HImage HImage::InpaintingTexture(const HRegion& Region, Hlong MaskSize, Hlong SearchSize, double Anisotropy, const char* PostIteration, double Smoothness) const

static void HOperatorSet.InpaintingTexture(HObject image, HObject region, out HObject inpaintedImage, HTuple maskSize, HTuple searchSize, HTuple anisotropy, HTuple postIteration, HTuple smoothness)

HImage HImage.InpaintingTexture(HRegion region, int maskSize, int searchSize, double anisotropy, string postIteration, double smoothness)

Description

The operator inpainting_textureinpainting_textureInpaintingTextureInpaintingTextureInpaintingTexture is used for removing large objects and image errors from the region RegionRegionRegionRegionregion of the input image ImageImageImageImageimage. Image blocks of side length MaskSizeMaskSizeMaskSizeMaskSizemaskSize are copied from the intact part of the image to the border of the computation area, until that area has been filled up with new gray values. This process is called image inpainting. Hence, the computation area is also referred to as the inpainting area and is reduced with every inserted rectangle, starting with RegionRegionRegionRegionregion. Let the center of the current block be at the point x. Since x is always chosen from the border of the inpainting area the current block overlaps with the known or already filled-in gray values. The gray value correlation with the overlapping part of this block is used to determine which other image block fits at the position x. As the correlation function, the sum of the squared gray value differences is used. The image blocks that are taken into account for the correlation, and hence as candidates for the data source of the next inpainting step, are called comparison blocks. The search area for suitable gray value patterns in which the centers of the comparison blocks is searched is limited to a square of side length 2*SearchSizeSearchSizeSearchSizeSearchSizesearchSize around the point x.

On the one hand, the order in which the pixels of RegionRegionRegionRegionregion are filled in depends on the size of the overlapping area and thus the number of pixels available for the correlation. On the other hand, the absolute value of the derivative of the gray value function tangential to the border of the computation area is also considered. The larger the value of the parameter AnisotropyAnisotropyAnisotropyAnisotropyanisotropy is, the more the points in which the derivative is large are preferred. This way it can be achieved that, e.g., straight lines which are represented by large gradients, are continued through the entire computation area without being interrupted by the inpainting of image structures from other parts of the border when the size of the inpainting area becomes small. On the other hand, a large value of AnisotropyAnisotropyAnisotropyAnisotropyanisotropy also means that possible phantom edges, i.e., unwanted random structures that have developed during the inpainting process, are also propagated and the magnitude of those image disturbances is increased.

To confine the formation of such artifacts, the original algorithm can be extended by a post-iteration step that selects smooth and inconspicuous image patches as data sources for the inpainting. If the parameter PostIterationPostIterationPostIterationPostIterationpostIteration is set to 'min_grad'"min_grad""min_grad""min_grad""min_grad" the sum of the squares of the gray value gradients is minimized on the comparison blocks. With the value 'min_range_extension'"min_range_extension""min_range_extension""min_range_extension""min_range_extension", the growth of the gray value interval of the comparison blocks with respect to the reference block around the point x is minimized. If PostIterationPostIterationPostIterationPostIterationpostIteration has the value 'none'"none""none""none""none" no post-iteration is performed. The choice of feasible blocks for this minimization process is determined by the parameter SmoothnessSmoothnessSmoothnessSmoothnesssmoothness, which is an upper limit to the permitted increase of the mean absolute gray value difference between the comparison blocks and the reference block with respect to the block that was selected by the original algorithm. With increasing value of SmoothnessSmoothnessSmoothnessSmoothnesssmoothness, the inpainting result becomes smoother and loses structure. The matching accuracy of the selected comparison blocks decreases. If SmoothnessSmoothnessSmoothnessSmoothnesssmoothness is set to 0, the post-iteration only considers comparison blocks with an equally high correlation to the reference block.

If the inpainting process cannot be completed because there are points x, for which no complete block of intact gray value information is contained in the search area of size SearchSizeSearchSizeSearchSizeSearchSizesearchSize, the remaining pixels keep their initial gray value and the ROI of the output image InpaintedImageInpaintedImageInpaintedImageInpaintedImageinpaintedImage is reduced by the region that could not be processed. If the structure size of the ROI of ImageImageImageImageimage or of the computation area RegionRegionRegionRegionregion is smaller than MaskSizeMaskSizeMaskSizeMaskSizemaskSize, the execution time of the algorithm can increase extremely. Hence, it is recommended to only use clearly structured input regions.

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

Parameters

ImageImageImageImageimage (input_object)  (multichannel-)image(-array) objectHImageHImageHobject (byte / uint2 / real)

Input image.

RegionRegionRegionRegionregion (input_object)  region objectHRegionHRegionHobject

Inpainting region.

InpaintedImageInpaintedImageInpaintedImageInpaintedImageinpaintedImage (output_object)  image(-array) objectHImageHImageHobject * (byte / uint2 / real)

Output image.

MaskSizeMaskSizeMaskSizeMaskSizemaskSize (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Size of the inpainting blocks.

Default value: 9

Suggested values: 7, 9, 11, 15, 21

Restriction: MaskSize >= 3 && odd(MaskSize)

SearchSizeSearchSizeSearchSizeSearchSizesearchSize (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Size of the search window.

Default value: 30

Suggested values: 15, 30, 50, 100, 1000

Restriction: 2 * SearchSize > MaskSize

AnisotropyAnisotropyAnisotropyAnisotropyanisotropy (input_control)  real HTupleHTupleHtuple (real) (double) (double) (double)

Influence of the edge amplitude on the inpainting order.

Default value: 1.0

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

Restriction: Anisotropy >= 0

PostIterationPostIterationPostIterationPostIterationpostIteration (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Post-iteration for artifact reduction.

Default value: 'none' "none" "none" "none" "none"

List of values: 'min_grad'"min_grad""min_grad""min_grad""min_grad", 'min_range_extension'"min_range_extension""min_range_extension""min_range_extension""min_range_extension", 'none'"none""none""none""none"

SmoothnessSmoothnessSmoothnessSmoothnesssmoothness (input_control)  real HTupleHTupleHtuple (real) (double) (double) (double)

Gray value tolerance for post-iteration.

Default value: 1.0

Suggested values: 0.0, 0.1, 0.2, 0.5, 1.0

Restriction: Smoothness >= 0

Module

Foundation


ClassesClasses | | Operators