[英]How to access individual labels in OpenCV connected component labelling
source = <some_image>
labels = <connected components result>
for label in np.unique(labels):
m = (labels == label) # boolean array/mask of pixels with this label
obj = source[m] # orignal pixel values for the labeled object
这将返回一个平坦的结果,从您的问题中不清楚这是否可以接受
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.