Python connected components with pixel list

后端 未结 2 1097
无人及你
无人及你 2021-01-19 05:03

In matlab you can use

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

To get pixel list of each connected components. What\'s the pyth

2条回答
  •  一整个雨季
    2021-01-19 05:22

    To get pixel list of a connected component with some_label (e.g. some_label=1), if you have a labeled image:

    pixels = numpy.argwhere(labeled_image == some_label)
    

    See numpy.argwhere.

    And see also this similar question.

提交回复
热议问题