簡體   English   中英

刪除scikit圖像中的標簽

[英]Removing labels in scikit-image

我已將二進制圖像標記為 在此處輸入圖片說明

imageLabels = morphology.label(imageBinary, background=255)

但是,當我檢查標簽數量時,我得到535個元素。

print(len(imageLabels))

作為解決方案,我考慮過使用measure.regionprops來刪除像素面積小的標簽。 你們將如何處理呢? 我嘗試了以下操作,但是由於某種原因,新數組不再被視為正確的標簽元素。

i=0
for labelprop in measure.regionprops(imageLabels):
    if (labelprop.area > 100):
        imageLabels_keep.append(imageLabels[i])
    i=i+1

我認為morphology.remove_small_objects(image, min_px_size)您的需求。 這是使用該功能的示例:

http://scikit-image.org/docs/dev/auto_examples/applications/plot_coins_segmentation.html#edge-based-segmentation

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM