import cv2 as cv
import numpy as np
src = cv.imread(’./star.png’)
gray = cv.cvtColor(src, cv.COLOR_BGR2GRAY)
ret, thresh = cv.threshold(gray, 127, 255, cv.THRESH_BINARY_INV)
Sobel 算子计算边缘
sobel_x = cv.Sobel(thresh, -1, 1, 0, ksize=3)
image = np.hstack((gray, thresh, sobel_x))
cv.imshow(“image”, image)
cv.waitKey(http://yezishuju.com/)