簡體   English   中英

如何以像素為單位查找區域 output

[英]How to find area in pixels output

我需要 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 看起來像在此處輸入圖像描述

我該如何解決這個問題或關於它的 go?

有一個內置的 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