1.一些渐变的例子
import cv2 import numpy as np frame = cv2.imread('avengers.jpg') laplacian = cv2.Laplacian(frame,cv2.CV_64F) sobelx=cv2.Sobel(frame,cv2.CV_64F,1,0,ksize=5) sobely=cv2.Sobel(frame,cv2.CV_64F,0,1,ksize=5) cv2.imshow('laplacian',laplacian) cv2.imshow('frame',frame) cv2.imshow('sobelx',sobelx) cv2.imshow('sobely',sobely) cv2.waitKey(0) cv2.destroyAllWindows()
2.canny 边缘检测
edges = cv2.Canny(frame,100,200)