Erode ImagesErode Images

The OpenCV is a set of Python bindings created to assist with solving computer vision problems. One of the methods it provides is cv2.erode(), which is used to perform erosion on an image. The concept behind erosion is similar to that of soil erosion in that it erodes away the boundaries of a foreground object. This method is typically used on binary images and takes two inputs: the original image and a structuring element or kernel that determines the nature of the operation. A pixel in the original image will only be considered a 1 if all the pixels under the kernel are also 1; otherwise, it is eroded or set to 0.


  1. Define a kernel of 15x15;
  2. Erode the "image1.jpg" variable;
  3. Show the image.

Everything was clear?

Section 1. Chapter 6

Start learning today and achieve
coding mastery

  • Master Python, SQL, JavaScript & more.
  • Learn with Step-by-Step Lessons.
  • Get Ready for Real-World Projects.
  • Earn a Certificate Upon Completion.