I have a graysacle png image and I want to extract all the connected components from my image. Some of the components have same intensity but I want to assign a unique label to every object. here is my image
I tried this code:
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
But I get just three objects using this. Please tell me how to get each object.