【问题标题】:shouldn't return type of skimage.filters.threshold_mean be from 0-255?skimage.filters.threshold_mean 的返回类型不应该是 0-255 吗?
【发布时间】:2020-06-26 23:26:17
【问题描述】:
bw_image = sk_col.rgb2gray(image)

fig = plt.figure(figsize=(3,3))
plt.imshow(bw_image, cmap="gray")
plt.show()

mean_val = threshold_mean(bw_image)

print('*****',mean_val,'******')

binary_image = bw_image > mean_val

fig = plt.figure(figsize=(3,3))
plt.imshow(binary_image, cmap="gray")
plt.title("Mean Threshold: " + str(mean_val))
plt.show()

问题是为什么我的平均值是 0.386 。我不应该得到 0-255 左右的值吗? skimage.color.rgb2gray 函数应返回像素范围为 0-255 的图像。但是当我打印像素时,我看到了 0 到 1 之间的值。

对于这种混乱,我无法理解如何找到二进制图像。检查了 skimage.color 的文档,但没有发现任何帮助。

【问题讨论】:

标签: machine-learning image-processing scikit-image


【解决方案1】:

skimage.color.rgb2gray(image) 方法返回归一化后的值,这就是所有值都在 0-1 之间的原因。答案就是这么简单。

【讨论】:

    猜你喜欢
    • 2013-04-04
    • 1970-01-01
    • 2021-07-12
    • 1970-01-01
    • 1970-01-01
    • 2013-03-20
    • 2015-02-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多