You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
382 B

import cv2
def dilation(image_path,ksize):
# 图像的二值化
src = cv2.imread(image_path, cv2.IMREAD_UNCHANGED)
ks = int(ksize)
# 交叉结构元
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (ks, ks))
# 进行膨胀
dilation = cv2.dilate(src, kernel)
cv2.imshow('result', dilation)
cv2.waitKey(0)
cv2.destroyAllWindows()