Hey guys,
right now I'm using the ximgproc module to apply the SLIC-algorithm to an image. So far, this works very well. I Problem is the following: I need to have an array, which stores for each superpixel all corresponding points in the image. This can be interpreted as:
Superpixel = [] #array which contains all superpixels/labels
Superpixel[0] =[] #Superpixel with label 0 contains an array of points
How is this efficiently done? Right now I'm using e.g. np.argwhere to find all coordinates with the specific label in the image and write it into the corresponding superpixel:
image = np.ndarray((352,1216),dtype = np.uint16) #is image where each point is assigned with a label/superpixel
for label in range(0,number_of_labels)
superpixel[label] = np.argwhere(image == label)
I think it can be seen, that this is a huge amount of calculation time. Is there any better way, to get all coordinates which are assigned to a specific superpixel?
Best and looking forward for some hints