Python连接的具有像素列表的组件 [英] Python connected components with pixel list

查看:153
本文介绍了Python连接的具有像素列表的组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在matlab中,您可以使用

In matlab you can use

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

获取每个已连接组件的像素列表.什么是python等效项? 我尝试过

To get pixel list of each connected components. What's the python equivalent? I tried

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

但是,要获取标签,此列表不附带像素列表.
有什么建议吗?

To get the labels, however, this does not come with pixel list.
Any suggestions?

推荐答案

regionprops 函数将返回属性"coords",即该区域的(N,2)个ndarray坐标列表(行,列).我遇到了同样的问题,并且正在使用它来从标签数组中获取像素列表.

The regionprops function in scikit-image returns the property "coords", an (N, 2) ndarray coordinate list (row, col) of the region. I ran into the same problem and am using this to get the pixel list from the label array.

这篇关于Python连接的具有像素列表的组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆