Removing defects from a photo with image inpainting

Sometimes, photo images have defects. This is especially the case for old photos that have been scanned: they may have scratches, spots, and stains. All these imperfections hinder enjoyment of the photo. The procedure of reconstructing parts of an image based on their surroundings is called inpainting, and OpenCV has an implementation of this algorithm. Here, we'll review ways of exploiting this OpenCV functionality.

Get OpenCV 3 Computer Vision with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.