
In practice, we did not find that to be the case.

Pros and ConsĪs per the theory and the papers, Navier-Stokes based inpainting is supposed to be slower and has a tendency to produce results that are blurrier than the Fast Marching based method.
#Image inpaint update
The author treats the missing region of the image as level sets and uses the fast marching method to update the boundary. Once a pixel is inpainted, the boundary needs to updated. The known neighborhood pixels and gradients are used to estimate the color of the pixel to be inpainted. Instead of using the image Laplacian as the estimator of smoothness, the author uses a weighted average over a known image neighborhood of the pixel to inpaint. This implementation solves the same constraints using a different technique. This implementation is based on a paper titled “ An Image Inpainting Technique Based on the Fast Marching Method” by Alexandru Telea. INPAINT_TELEA : Fast Marching Method based The benefit of reducing the problem to one of fluid dynamics is that we benefit from well developed theoretical analysis and numerical tools. The authors show that these equations are closely related in form to the Navier-Stokes equations for 2D incompressible fluids. The isophotes are estimated by the image gradient rotated by 90 degrees. The image smoothness information is estimated by the image Laplacian and it is propagated along the isophotes (contours of equal intensities). The authors set up a partial differential equation (PDE) to update image intensities inside the region with the above constraints.

In this section, we will briefly discuss two inpainting algorithms implemented in OpenCV. It is also used for removing small unwanted objects in an image. The most common application of image inpainting is restoration of old scanned photos.

The region is identified using a binary mask, and the filling is usually done by propagating information from the boundary of the region that needs to be filled. Image inpainting is a class of algorithms in computer vision where the objective is to fill regions inside an image or a video. If your friends do not look sufficiently impressed, you can tell them the method is based on the Navier Stokes equation they might have encountered in fluid dynamics!īut to be that cool, you need to read this post first.
#Image inpaint code
You open your favorite editor and write 10 lines of code to solve the problem using an inpainting algorithm in OpenCV. You are a super cool engineer! You have a reputation to live up to. Of course you can load the photo in Photoshop and fix the scratches. You scan it and it looks great except for a few scratches. Imagine finding an old family photograph.
