Skip to content

# Content-aware Fill

Back to MIB | User interface | Menu | Image

## Description

Reconstruct selected areas of the dataset using information from neighboring regions, modifying the image and corresponding Selection, Mask, and Model layers.

Demonstration

- Content-aware fill demonstration

## inpaintCoherent

Restores specific regions of the dataset using coherence transport-based inpainting, leveraging patterns from surrounding areas to fill gaps seamlessly. This method is available for MATLAB R2019a and newer.

Select regions to inpaint using the Mask or Selection layers in the Segmentation panel.

Configure the following parameters:

- Method use the dropdown to select `inpaintCoherent`
- Mask select the layer that has marked areas that should be content aware filled
- Mode specify whether the content aware fill should be applied for the current slice or the whole dataset
- Radius set the radius of the circular neighborhood (in pixels) centered on each pixel to be inpainted, controlling the scope of surrounding data used.
- Smoothing Factor define the Gaussian filter scale for estimating coherence direction, adjusting the smoothness of the inpainting result.

Click the Apply button to reconstruct the selected areas across the dataset or specific slices, preserving continuity with neighboring regions.

Reference

- F. Bornemann and T. März, "Fast Image Inpainting Based on Coherence Transport," Journal of Mathematical Imaging and Vision, Vol. 28, 2007, pp. 259–278.
- inpaintCoherent at Mathworks.com

## inpaintExemplar

Fills regions in the dataset using exemplar-based inpainting, copying patches from nearby areas to reconstruct missing or selected parts. This method is available for MATLAB R2019b and newer.

Specify regions to inpaint using the Mask or Selection layers in the Segmentation panel.

Configure the following parameters:

- Method use the dropdown to select `inpaintCoherent`
- Mask select the layer that has marked areas that should be content aware filled
- Mode specify whether the content aware fill should be applied for the current slice or the whole dataset
- PatchSize enter the size of image patches (e.g., `9` for a 9x9 patch or `9,9` for custom dimensions) used for matching and filling.
- FillOrder select the priority function for the order in which patches are filled, such as structure-driven or edge-first approaches.

Click the Apply button to fill the selected areas, blending patches to maintain visual consistency across the dataset.

Reference

- A. Criminisi, P. Perez, and K. Toyama, "Region Filling and Object Removal by Exemplar-Based Image Inpainting," IEEE Trans. on Image Processing, Vol. 13, No. 9, 2004, pp. 1200–1212.
- inpaintExemplar at Mathworks.com

Back to MIB | User interface | Menu | Image