# -*- coding:utf - 8 -*-
import cv2
img = cv2.imread("C:/Users/Administrator/Desktop/gou.jpg", 0)
def on_canny():
mix = cv2.getTrackbarPos("mix","s")
max = cv2.getTrackbarPos("max","s")
edges = cv2.Canny(img,mix,max)
cv2.imshow("s", edges)
cv2.namedWindow("s")
cv2.createTrackbar("mix","s",0,255,on_canny)
cv2.createTrackbar("max","s",0,255,on_canny)
while(1):
on_canny()
k = cv2.waitKey(1)&0xFF
if k == 27:
break
cv2.destroyAllWindows()
opencv-python 应用滑动条改变canny边缘检测的阈值
最新推荐文章于 2024-09-12 21:43:49 发布