Inpainting is the task of reconstructing missing regions in an image. OpenCV implements two methods that work well to rebuild small portions in an image. For large pieces or very textured areas, these algorithms show some limitations.


The task was to implement a prototype of texture inpainting that can be used to restore small pieces in an image with a very textured background.


The complete process is detailed in a blog post (see the source below). To summarize, we implemented an algorithm to generate texture from image quilting with a KDTree to find the best similarities between adjacent cells. As a proof of concept, we implemented the most basic method that works well for small inpainting. Several improvements can be made to get better results and speed up the process.