Let's restore a damaged image
In this exercise, we'll restore an image that has missing parts in it, using the inpaint_biharmonic()
function.

defect_image
.We'll work on an image from the data
module, obtained by data.astronaut()
. Some of the pixels have been replaced with 0s using a binary mask, on purpose, to simulate a damaged image. Replacing pixels with 0s turns them totally black. The defective image is saved as an array called defect_image
.
The mask is a black and white image with patches that have the position of the image bits that have been corrupted. We can apply the restoration function on these areas. This mask is preloaded as mask
.
Remember that inpainting is the process of reconstructing lost or deteriorated parts of images and videos.
This exercise is part of the course
Image Processing in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the module from restoration
from ____.____ import ____