import cv2 import numpy as np import os global allmin global allmax global allarea global allnum allmin=50000 allmax=0 allarea=0 allnum=0 def Change(img): # 改黑白图为白黑图,也可以用cvThreshold函数 sp = img.shape height = sp[0] # height(rows) of image width = sp[1] # width(colums) of image size = (width, height) iTmp = np.zeros(img.shape, np.uint8) for i in range(height): for j in range(width): iTmp[i, j] = 255 - img[i, j] cv2.imwrite(path, iTmp)# 覆盖原黑白图 print("图像 %s 覆盖成功!" % (path)) # 消除微小区域 def Big(contour): c_max &#
python处理缺陷图象返回缺陷面积数量
最新推荐文章于 2024-05-19 15:20:30 发布