January 2018
Intermediate to advanced
268 pages
6h 20m
English
Erosion and dilation are morphological image processing operations. Morphological image processing basically deals with modifying geometric structures in the image. These operations are primarily defined for binary images, but we can also use them on grayscale images. Erosion basically strips out the outermost layer of pixels in a structure, whereas dilation adds an extra layer of pixels to a structure.
Let's see what these operations look like:

Following is the code to achieve this:
import cv2 import numpy as np img = cv2.imread('images/input.jpg', 0) kernel = np.ones((5,5), np.uint8) img_erosion = cv2.erode(img, kernel, ...Read now
Unlock full access