我有一個graysacle png圖像,我想從我的圖像中提取所有連接的組件。 某些組件具有相同的強度,但我想爲每個對象分配一個唯一的標籤。 這裏是我的形象從Python中的圖像中提取連接的對象
我試過這段代碼:
img = imread(images + 'soccer_cif' + str(i).zfill(6) + '_GT_index.png')
labeled, nr_objects = label(img)
print "Number of objects is %d " % nr_objects
但我得到的只有三個使用該對象。 請告訴我如何獲取每個對象。
'label'函數來自哪裏? –
可能的解決方案:http://stackoverflow.com/a/5304140/190597 – unutbu
我正在使用類似的東西。標籤功能是從scipy.ndimage 但得到的結果,我張貼 – Khushboo