img = cv2.imread(r'F:pythonworkcv_learnclipboard.png',1) cv2.imshow('input',img) kernel = np.array([[0, -1, 0], [0, 5, 0], [0, -1, 0]])#定义卷积核 imageEnhance = cv2.filter2D(img,-1, kernel)#进行卷积运算
img = cv2.imread(r'F:pythonworkcv_learnclipboard.png',1) cv2.imshow('input',img) kernel = np.array([[0, -1, 0], [0, 5, 0], [0, -1, 0]])#定义卷积核 imageEnhance = cv2.filter2D(img,-1, kernel)#进行卷积运算