Removing logos
As we saw in the video, another use of image restoration is removing objects from an scene. In this exercise, we'll remove the Datacamp logo from an image.
Image loaded as
image_with_logo
.
You will create and set the mask to be able to erase the logo by inpainting this area.
Remember that when you want to remove an object from an image you can either manually delineate that object or run some image analysis algorithm to find it.
This is a part of the course
“Image Processing in Python”
Exercise instructions
- Initialize a mask with the same shape as the image, using
np.zeros()
. - In the mask, set the region that will be inpainted to 1 .
- Apply inpainting to
image_with_logo
using themask
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Initialize the mask
mask = ____(____[:-1])
# Set the pixels where the logo is to 1
mask[210:290, 360:425] = ____
# Apply inpainting to remove the logo
image_logo_removed = inpaint.____(____,
____,
multichannel=True)
# Show the original and logo removed images
show_image(image_with_logo, 'Image with logo')
show_image(image_logo_removed, 'Image with logo removed')
This exercise is part of the course
Image Processing in Python
Learn to process, transform, and manipulate images at your will.
So far, you have done some very cool things with your image processing skills! In this chapter, you will apply <strong>image restoration to remove objects, logos, text, or damaged areas</strong> in pictures! You will also learn how to apply noise, use segmentation to speed up processing, and find elements in images by their contours.
Exercise 1: Image restorationExercise 2: Let's restore a damaged imageExercise 3: Removing logosExercise 4: NoiseExercise 5: Let's make some noise!Exercise 6: Reducing noiseExercise 7: Reducing noise while preserving edgesExercise 8: Superpixels & segmentationExercise 9: Number of pixelsExercise 10: Superpixel segmentationExercise 11: Finding contoursExercise 12: Contouring shapesExercise 13: Find contours of an image that is not binaryExercise 14: Count the dots in a dice's imageWhat is DataCamp?
Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.