Inpainting is the process of restoring the damaged or missing parts of an image. Suppose we have a binary input image, D, that specifies the location of the damaged pixels in the input image, f, as shown in the following equation:
Once the damaged regions in the image are located with the mask, the lost/damaged pixels have to be reconstructed with some algorithm (for example, total variation inpainting). The reconstruction is supposed to be performed fully automatically by exploiting the information presented in non-damaged regions. In this recipe, you will learn how to use OpenCV-Python library functions to implement image inpainting, using two different algorithms.