# 实质是卷积运算
import cv2
import numpy as np
import random
img = cv2.imread('image0.jpg',1)
imgInfo = img.shape
height = imgInfo[0]
width = imgInfo[1]
# 1.灰度图像处理
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
# 2.高斯滤波
imgG = cv2.GaussianBlur(gray,(3,3),0)
# 3.dst 图片经过卷积元素后,
dst = cv2.Canny(imgG,50,50)
cv2.imshow('dst',dst)
cv2.waitKey(0)
边缘检测算法|python
最新推荐文章于 2024-04-13 16:06:01 发布