图像梯度感觉是用来提取出图像内部的轮廓:
import cv2
import matplotlib.pyplot as plt
img = cv2.imread('logo.jpg',0)
sobelx = cv2.Sobel(img,cv2.CV_64F,1,0,ksize=5)
sobely = cv2.Sobel(img,cv2.CV_64F,0,1,ksize=5)
laplacian =cv2.Laplacian(img,cv2.CV_64F)
title = ['original','sobelx','sobely','laplacian']
images = [img,sobelx,sobely,laplacian]
for i in range(4):
plt.subplot(2,2,i+1),plt.imshow(images[i],'gray'),plt.title(title[i])
plt.xticks([]),plt.yticks([])
plt.show()