1、介绍
梯度=膨胀-腐蚀
gradient = cv2.morphologyEx(img, cv2.MORPH_GRADIENT, kernel)
2、代码
import cv2
import numpy as np
# 形态学梯度运算=膨胀-腐蚀
img = cv2.imread('lena.jpg', 0)
kernel = np.ones((5, 5), np.uint8)
dilate
1、介绍
梯度=膨胀-腐蚀
gradient = cv2.morphologyEx(img, cv2.MORPH_GRADIENT, kernel)
2、代码
import cv2
import numpy as np
# 形态学梯度运算=膨胀-腐蚀
img = cv2.imread('lena.jpg', 0)
kernel = np.ones((5, 5), np.uint8)
dilate