Definition:Image inpainting refers to the process of filling-in missing data in a designated region of the visual input.
Inpainting is a method of restoration where broken, decaying or missing pieces of an artwork are filled in to give a full picture. This process can be extended to both tangible and visual art forms such as oil or acrylic paints, chemical photographic prints, three-dimensional drawings, or visual photographs and film.
Picture painting is the practice of reconstructing missing parts of a picture so that viewers are unable to claim they have undergone restoration in these regions. Sometimes, this technique is used to delete unwanted artifacts from an image or to restore damaged parts of old images.The figures below show picture painting results for example.
![]() |
Destroyed Image |
↓
![]() |
Restored Image |
The modern use of painting may be traced back to Pietro Edwards (1744-1821), Director of Public Picture Restoration in Venice, Italy. Taking a theoretical approach, Edwards focused his energies on restoring the artist's intentions.
Technological advancements led to new applications of inpainting. Widespread use of digital techniques range from entirely automatic computerized inpainting to tools used to simulate the process manually. Since the mid-1990s, the process of inpainting has evolved to include digital media.
Inpainting is the method of reconstructing parts of images and videos lost or worsened. In the world of museums, in the case of a valuable painting, a skilled art conservator or art renovator would perform this task. In the digital world, inpainting refers to sophisticated algorithms being applied to recover lost or damaged parts of image data.
How Program recreate destroyed image
Deep learning over the last few years has had mind blowing success over computer vision and image processing.
OpenCV has two methods incorporated to it. The same function, cv2.inpaint(),can access both, which simply requires a destroyed image and a layer mask.
Destroyed |
Mask |
Fast Marching Method
The first is based on a Fast Marching Method, which begins to be unpainted from the region's perimeter and moves towards the apex, rapidly filling everything within the perimeter first.Each pixel is substituted by a weighted normalized sum of all known local pixels.Weight selection is an important topic. Those pixels lying near the perimeter of missing parts, like those near contours, are given more weighting. Using the Fast Marching Method, once a pixel is unpainted, it moves to the next closest pixel, ensuring that those pixels closest to the known pixels are first inpainted.
res = cv.inpaint(src=img_mask, inpaintMask=inpaintMask, inpaintRadius=2, flags=cv.INPAINT_TELEA) cv.imshow("Inpaint output using FMM",res)
Heuristic Principle
The second method is based on a heuristic principle containing fluid dynamics as well as partial differential equations. It first goes from recognized regions to unknown regions along the edges (because edges are meant to be continuous).It continues to move along isophotes, which can be thought of as lines joining points with the same frequency, matching gradient vectors at the inpainting region's perimeter.
res = cv.inpaint(src=img_mask, inpaintMask=inpaintMask, inpaintRadius=2, flags=cv.INPAINT_NS) cv.imshow("Inpaint output using NS",res)
👉Source code
Different Approaches of Image Inpainting Techniques
A. Partial Differential Equation (PDE) based.
B. Texture synthesis based.
C. Exemplar based.
D. Hybrid based.
E. Semi-automatic and Fast.
F. Wavelet transformation based.
G. Discrete cosine transform based inpainting.
Pros and Cons
No comments