Inpainting is a conservation process where damaged, deteriorated, or missing parts of an artwork are filled in to present a complete image. This process is commonly used in image restoration. It can be applied to both physical and digital art mediums such as oil or acrylic paintings, chemical photographic prints, sculptures, or digital images and video.
With its roots in physical artwork, such as painting and sculpture, traditional inpainting is performed by a trained art conservator who has carefully studied the artwork to determine the mediums and techniques used in the piece, potential risks of treatments, and ethical appropriateness of treatment.
The modern use of inpainting can be traced back to Pietro Edwards (1744–1821), Director of the Restoration of the Public Pictures in Venice, Italy. Using a scientific approach, Edwards focused his restoration efforts on the intentions of the artist.
It was during the 1930 International Conference for the Study of Scientific Methods for the Examination and Preservation of Works of Art, that the modern approach to inpainting was established. Helmut Ruhemann (1891–1973), a German restorer and conservator, led the discussions on the use of inpainting in conservation. Helmut Ruhemann was a leading figure in modernizing restoration and conservation. His greatest contribution to the field of conservation "was his insistence on following the methods of the original painter exactly, and on understanding the painter's artistic intention". After his career of over 40 years as a conservator, Ruhemann published his treatise The Cleaning of Paintings: Problems & Potentialities in 1968. In describing his method, Ruhemann states that "The surface [of the fill] should be slightly lower than that of the surrounding paint to allow for the thickness of the inpainting...Inpainting medium should look and behave like the original medium, but must not darken with age." Cesare Brandi (1906–1988) developed the teoria del restauro, the inpainting approach combining aesthetics and psychology. However, this approach was used primarily by Italian restorers and conservators, with the terminology becoming widespread in the 1990s.
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. More commonly known as image or video interpolation, a form of estimation, digital inpainting includes the use of computer software that relies on sophisticated algorithms to replace lost or corrupted parts of the image data.
In order to preserve the integrity of an original artwork, any inpainting technique or treatment applied to physical or digital work should be reversible or distinguishable from the original content of the artwork. Prior to any treatments, conservators proceed according to the American Institute of Conservation of Historical and Artistic Works.
There are several ethic considerations before Inpainting can be justified. Various deliberation decisions over the ethical appropriateness of the amount and type of inpainting done, resides on many factors. As most conservation treatments, inpainting's ethical questions rest mainly with authenticity, reversibility and documentation.
"Any intervention to compensate for loss should be documented in treatment records and reports and should be detectable by common examination methods. Such compensation should be reversible and should not falsely modify the known aesthetic, conceptual, and physical characteristics of the cultural property, especially by removing or obscuring original material."
In an age of museum tourism, new technologies and aesthetic demand for perfect images without imperfections, continue to challenge conservators' ethical practices to protect the integrity of originals.
Inpainting method techniques depend on the desired goal and type of image being treated. Treatments to fill in the gaps are very different between physical and digital art.
With all applications of inpainting, it is important to keep detailed records of the initial state of the images, treatments done and justification for treatment, and the original copies when applicable (e.g. original digital images).
[[File:Piero della Francesca - Scene after and before restoration - WGA17592.jpg|thumb|Piero della Francesca – Scene after and before restoration]
Inpainting is rooted in the restoration of painted images. In the conservation and restoration of paintings, "the term inpainting refers to the compensation of paint losses – aiming at the recomposition of the missing parts of an image in order to improve its perception by making damages less visible". In other words, inpainting aims to make a visual improvement to the artwork as a whole by repairing missing or damaged parts using methods and materials equivalent to the original artist's work.
By studying the painting methods of various artists, the composition of paints used historically, and taking the time to carefully study the medium one is working with, conservators are able to, using an array of methodology, restore works very closely to their original visual appearance.
Other tips of inpainting:
Helmut Ruhemann's Inpainting Techniques by Jessell is filled with technique choices and procedures to "preserve" the quality of Oil and early Tempera paintings.
Many programs are able to reconstruct missing or damaged areas of digital photographs and videos. Most widely known for use with digital images is Adobe Photoshop. Since the digital files are able to be duplicated, any restorative alterations should be made to the duplicate file, while maintaining the original files in an archive. Given the various abilities of the digital camera and the digitization of old photos, inpainting has become an automatic process that can be performed on digital images. More than mere scratch removal, the inpainting techniques can also be applied to object removal, text removal, and other automatic modifications of images and videos. In video special effects inpainting is usually performed after video matting. Furthermore, they can also be observed in applications like image compression and super resolution.
In photography and cinema, it is used for film restoration to reverse, repair, or mitigate deterioration (e.g. physical damage such as cracks in photographs or scratches and dust spots in film or chemical damage resulting in image loss; see infrared cleaning). It can also be used for removing red-eye, the stamped date from photographs, and removing objects for creative effect.
This technique can be used to replace any lost blocks in the coding and transmission of images, for example, in a streaming video. It can also be used to remove logos in videos.
Deep learning neural network based inpainting can be used for decensoring images.
Deep Image Prior based techniques can be used for digital image inpainting, where a trained deep learning model is either unavailable or infeasible.
Three main groups of 2D image inpainting algorithms can be found in literature. The first one to be noted is structural (or geometric) inpainting, the second one is texture inpainting, and the last one is a combination of these two techniques. All these inpainting methods have one thing in common: they use the information of the known or non-destroyed image areas in order to fill the gap, similar to how physical images are restored.
Structural or geometric inpainting is used for smooth images that have strong, defined borders. There are many different approaches to geometric inpainting, but they all stem from the same idea that geometry can be recovered from similar areas or domains. Bertalmio proposed a method of structural inpainting that mimics how conservators address painting restoration. Bertalmio proposed that by progressively transferring similar information from the borders of an inpainting domain inwards, the gap can be filled.
While structural/geometric inpainting works to repair smooth images, textural inpainting works best with images that are heavily textured. Texture has a repetitive pattern which means that a missing portion cannot be restored by continuing the level lines into the gap; level lines provide a complete, stable representation of an image. To repair texture in an image, one can combine frequency and spatial domain information to fill in a selected area with a desired texture. This method, while the most simple and very effective, works well when selecting a texture to be in-painted. For a texture that covers a wider area or a larger frame one would have to go through the image segmenting the areas to be in-painted and selecting the corresponding textures from throughout the image; there are programs that can help find the corresponding areas that work in a similar way as 'find and replace' works in a word processor.
Combined structural and textural inpainting approaches simultaneously try to perform texture- and structure-filling in regions of missing image information. Most parts of an image consist of texture and structure and the boundaries between image regions contain a large amount of structural information. This is the result when blending different textures together. That is why state-of-the-art methods attempt to combine structural and textural inpainting.
A more traditional method is to use differential equations (such as Laplace's equation) with Dirichlet boundary conditions for continuity so as to create a seemingly seamless fit. This works well if missing information lies within the homogeneous portion of an object area.
Other methods follow isophote directions (in an image, a contour of equal luminance), to do the inpainting. Recent investigations included the exploration of the wavelet transform properties to perform inpainting in the space-frequency domain, obtaining a better performance when compared to the frequency-based inpainting techniques.
Model based inpainting follows the Bayesian approach for which missing information is best fitted or estimated from the combination of the models of the underlying images, as well as the image data actually being observed. In deterministic language, this has led to various variational inpainting models.
Manual computer methods include using a clone tool to copy existing parts of the image to restore a damaged texture. Texture synthesis may also be used.
Exemplar-based image inpainting attempts to automate the clone tool process. It fills "holes" in the image by searching for similar patches in a nearby source region of the image, and copying the pixels from the most similar patch into the hole. By performing the fill at the patch level as opposed to the pixel level, the algorithm reduces blurring artifacts caused by prior techniques.