场景

    对大米预处理之后的二值图像做开运算再做canny边缘检测。

python代码:

 1 # kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(3,3))  # 椭圆的核
 2 
 3 kernel = np.ones((3,3),np.uint8)    # 去除白色噪点,形态学开运算,3x3线性核
 4 
 5 opening = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel, iterations = 2)
 6 
 7 cv2.imshow("opening",opening)
 8 
 9  
10 
11 edges = cv2.Canny(opening,50,200)
12 
13 cv2.imshow("edges",edges)
View Code

相关文章:

  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2021-12-16
  • 2021-06-18
  • 2021-08-03
  • 2021-11-16
猜你喜欢
  • 2021-12-05
  • 2021-11-03
  • 2021-09-03
  • 2021-06-17
  • 2022-12-23
相关资源
相似解决方案