Dilation and erosion manipulate the structure of shapes in images using kernels.
import cv2 import numpy as np def morphology_ops(img): kernel = np.ones((5,5), np.uint8) return cv2.morphologyEx(img, cv2.MORPH_CLOSE, kernel)