Python-OpenCV 像素点区域面积计算(莫来石)

import cv2
img = cv2.imread("01result1.bmp")############图片读取
pictue_size=img.shape
picture_height=pictue_size[0]
picture_width=pictue_size[1]
print(picture_height,picture_width)

i = 0
for a in range(picture_height):
    for b in range(picture_width):
        if img[a,b].all() > 0:
            i= i + 1
print(i)

你可能感兴趣的:(黏土砖,墙上裂纹处理,python,opencv)