def getDarkColorPercent(image):
height = np.size(image, 0)
width = np.size(image, 1)
imgSize = width * height
result = cv2.threshold(image, 100, -1, cv2.THRESH_TOZERO)[1]
nonzero = cv2.countNonZero(result)
if nonzero > 0:
return (imgSize - nonzero) / float(imgSize)
else:
return 0
# ???????
评论列表
文章目录