Python-connected components with a list of pixels

In matlab you can use

cc = bwconncomp(bimg); pixels = cc.PixelIdxList{i} 

Get a list of pixels for each connected component. What is the python equivalent? I tried

 from skimage import measure label = measure.label(bimg) 

To get tags, however, this does not apply to the list of pixels.
Any suggestions?

+2
source share
1 answer

The regionprops function in scikit-image returns the property "coords", a list of coordinates (N, 2) ndarray (line, col) of the area. I ran into the same problem and use this to get a list of pixels from an array of labels.

+1
source

Source: https://habr.com/ru/post/1275338/


All Articles