我有一个单独的对象,有一种颜色的图像。你知道吗
示例图像:
我想得到每个物体的所有像素。我使用Python和CV2。但我不知道怎么做。你知道吗
我想得到的例子:
- 对象1:[(x1,y1),(x2,y2)。。。(xn1,yn1)],其中n1-计算object1中的所有像素
- 对象2:[(x1,y1),(x2,y2)。。。(xn2,yn2)],其中n2-计算object2中的所有像素
- 。。。你知道吗
- 对象M:[(x1,y1),(x2,y2)。。。(xnm,ynm)]其中nm-计算objectm中的所有像素
升级:这可以通过cv2.connectedComponents()完成。看这个connected component labeling in python。谢谢beaker
Tags:
考虑到img在“img”中是开放的 可以使用immg[i,j]返回蓝-红-绿eg的值
所以你可以用
相关问题 更多 >
编程相关推荐