0

Is there a method/algorithm to generate instances of objects from image that was segmented by the use of any image segmentation models?

For example, I have an image with one class and it was segmented in a given way, where 1s are objects of the same class and empty fields are of no class:enter image description here

How can I now generate list of the two objects, where list's elements for example would be positions of all the pixels inside the object (list of list).

GKozinski
  • 1,240
  • 8
  • 19

1 Answers1

0

Those segmented instances can be seen as connected components of the 1s. You can use the flood fill or BFS algorithm to detect these components or try SimpleBlobDetector by OpenCV.

  • 1
    "flood fill" finally worked out for me, there is a nice implementation in scikit-image library , although I had to make a loop to go through all objects, because basic implementation can only fill one "blob" of 1s at a time – GKozinski Sep 01 '21 at 10:54