简体   繁体   English

如何以像素为单位查找区域 output

[英]How to find area in pixels output

I need to output the area in pixels for the binary_mole.我需要 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)

My attempt to find the area in pixels is below我试图以像素为单位查找区域如下

trys = np.sum(binary_mole == 255)
print('number of white pixels = ' , trys)

The binary_mole looks like binary_mole 看起来像在此处输入图像描述

How do I fix this or go about it?我该如何解决这个问题或关于它的 go?

There is a built in function called regionprops, that has numerous measurements.有一个内置的 function 称为 regionprops,它有许多测量值。

import skimage.measure as meas
binary_label = meas.label(binary_mole)
measurements = meas.regionpros(binary_label)

area = measurements[0]['area']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM