OpenCV中Super Pixel Segmentation的输出中每个值的含义是什么?

我目前正在研究超级像素分割。我正在使用简单线性迭代聚类(SLIC)。这是代码


# load the image and apply SLIC and extract (approximately)

# the supplied number of segments

image = cv2.imread(args["image"])

segments = slic(img_as_float(image), n_segments = 100, sigma = 5)


# show the output of SLIC

fig = plt.figure("Superpixels")

ax = fig.add_subplot(1, 1, 1)

ax.imshow(mark_boundaries(img_as_float(cv2.cvtColor(image, cv2.COLOR_BGR2RGB)), segments))

plt.axis("off")

plt.show()

我得到了段的输出


array([[ 0,  0,  0, ...,  7,  7,  7],

       [ 0,  0,  0, ...,  7,  7,  7],

       [ 0,  0,  0, ...,  7,  7,  7],

       ...,

       [76, 76, 76, ..., 84, 84, 84],

       [76, 76, 76, ..., 84, 84, 84],

       [76, 76, 76, ..., 84, 84, 84]])

段中的每个值是什么意思?


HUX布斯
浏览 230回答 1
1回答

牛魔王的故事

你的用法让我觉得这是 scikit 的 slic 函数吧?这在它的文档称它返回什么:返回: 标签: 2D 或 3D 数组表示段标签的整数掩码。这意味着它将是一张像您提供的图像一样的图像,它会告诉您每个像素的标签是什么。因此,如果您在此返回图像的某个像素中具有值 1,则意味着它属于集群 1,依此类推,直到您在 中提供的值n_segments = 100。如果您有疑问,请发表评论:)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python