Back to Adaptive Vision Library website

You are here: Start » Function Reference » Image » Image Enhancement » InpaintImage

InpaintImage


Header: AVL.h
Namespace: avl
Module: FoundationPro

Fills in a region of an image with pixel values interpolated from the borders of the area.

Applications: Speculative setting of unknown (or unwanted) pixels. Usually used for preparing incomplete images for further processing.

Syntax

C++
C#
 
void avl::InpaintImage
(
	avl::Image& ioImage,
	float inLambda,
	const avl::ShapeRegion& inRegionToInpaint,
	atl::Optional<const avl::CoordinateSystem2D&> inRoiAlignment
)

Parameters

Name Type Range Default Description
ioImage Image&
inLambda float 0.0 - 1.0 0.5f Ratio between vertical and horizontal interpolation
inRegionToInpaint const ShapeRegion& Region to be inpainted
inRoiAlignment Optional<const CoordinateSystem2D&> NIL Adjusts the region

Description

The filter fills in the region (inRegionToInpaint) within the image (inImage) using the color of the surrounding (external border) of the region. The value of the pixel is a weighted average of horizontal and vertical linear interpolation, where the weight is defined by the parameter inLambda.
Thus it is a weighted average of four pixels: the closest pixel of the remaining image in four directions, where the weight is reversed distance between pixels times the parameter (which is inLambda for the upper and lower and 1.0-inLambda for the left and right pixels). In case one of those points doesn't exist, it's just omitted in averaging. If none of the point exist, the color is zero.

Examples

Example image

Output for example image

Remarks

It works well when the image around the region is "uniform" in the sense that the (external) border of the region is smooth. If not, the interpolated surface is striped/chequered.

Errors

List of possible exceptions:

Error type Description
DomainError Region exceeds an input image in InpaintImage.