MulaiMulai sekarang secara gratis

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.

Landscape with small datacamp logo
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.

Latihan ini adalah bagian dari kursus

Image Processing in Python

Lihat Kursus

Petunjuk latihan

  • 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 the mask.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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')
Edit dan Jalankan Kode