【问题标题】:What is the meaning of each value in the output of Super Pixel Segmentation in OpenCV?OpenCV中Super Pixel Segmentation的输出中每个值的含义是什么?
【发布时间】:2018-10-24 14:53:17
【问题描述】:

我目前从事超像素分割。我正在使用简单线性迭代聚类(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]])

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

【问题讨论】:

    标签: python opencv


    【解决方案1】:

    你的用法让我觉得这是 scikit 的 slic 函数吧?

    its documentation 中的哪个说明了它返回的内容:

    返回: labels : 2D 或 3D 数组表示段标签的整数掩码。

    这意味着它将是您提供的图像,它会告诉您每个像素的标签是什么。因此,如果您在返回的图像的某个像素中具有值 1,则表示它属于集群 1,依此类推,直到您在 n_segments = 100 中提供的值。

    如果您有疑问,请发表评论:)

    【讨论】:

      猜你喜欢
      • 2013-07-27
      • 2019-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-06
      • 2019-04-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多