我目前有一个matlab脚本,而不是我想用python编写的脚本,我想知道python中是否有等效于“ bwconncomp”和“ label matrix”的函数可以评估多维二进制数组。
使用skimage库,您可以标记离散图像的连接组件。当两个像素相邻时,两个像素具有相同的值。在2D模式下,它们可以是1或2连接的邻居。
skimage
from skimage import measure all_labels = measure.label(blobs)
您可以找到更多详细信息here和here