如何在像素输出中查找区域
How to find area in pixels output
我需要输出 binary_mole 的面积(以像素为单位)。
mole_1 = mpimg.imread('mole_1.png')
gray_mole = rgb2grey(mole_1)
threshold = skimage.filters.threshold_otsu(gray_mole)
binary_mole = (gray_mole < threshold)
我试图找到以像素为单位的面积如下
trys = np.sum(binary_mole == 255)
print('number of white pixels = ' , trys)
binary_mole看起来像
我该如何解决或解决这个问题?
有一个名为 regionprops 的内置函数,它有很多测量值。
import skimage.measure as meas
binary_label = meas.label(binary_mole)
measurements = meas.regionpros(binary_label)
area = measurements[0]['area']
我需要输出 binary_mole 的面积(以像素为单位)。
mole_1 = mpimg.imread('mole_1.png')
gray_mole = rgb2grey(mole_1)
threshold = skimage.filters.threshold_otsu(gray_mole)
binary_mole = (gray_mole < threshold)
我试图找到以像素为单位的面积如下
trys = np.sum(binary_mole == 255)
print('number of white pixels = ' , trys)
binary_mole看起来像
我该如何解决或解决这个问题?
有一个名为 regionprops 的内置函数,它有很多测量值。
import skimage.measure as meas
binary_label = meas.label(binary_mole)
measurements = meas.regionpros(binary_label)
area = measurements[0]['area']