I am trying to access individual labels of objects with OpenCV's connectedComponentsWithStats in Python. However, when I run the connectedComponentsWithStats function, a labelled array is returned that has each object with different pixel values. How do I efficiently access each labelled object as a separate array? I am using very large images here with about 12000 x 10000 pixel dimensions.
I have an image here that has been labelled with cv.connectedComponentsWithStats:
The colormap used starts with purple(1) and ends with yellow (last label). How do I reference each labelled object independently as a separate array?