Scharr算子
算法和Sobel算子一样,但是将边界的更加突出
# scharr 默认scharr算子矩阵是(3,3)
scharrx = cv2.Scharr(img, cv2.CV_64F, 1, 0)
scharry = cv2.Scharr(img, cv2.CV_64F, 0, 1)
scharrx = cv2.convertScaleAbs(scharrx)
scharry = cv2.convertScaleAbs(scharry)
scharrxy = cv2.addWeighted(scharrx, 0.5, scharry, 0.5, 0)
cv2.imshow('scharrxy', scharrxy)
laplacian算子
类似高斯,但是会对噪点敏感。
# laplacian
laplacian = cv2.Laplacian(img, cv2.CV_64F)
laplacian = cv2.convertScaleAbs(laplacian)
cv2.imshow('laplacian', laplacian)