【发布时间】:2019-03-05 00:24:49
【问题描述】:
在给定像素值而不是坐标的情况下,我想通过彩色值更改灰度像素值。 给定坐标我知道该怎么做:
I = np.dstack([im, im, im])
x = 5
y = 5
I[x, y, :] = [1, 0, 0]
plt.imshow(I, interpolation='nearest' )
但是如何在像 I[im == 10] = [1, 0 ,0] 这样的值中做到这一点 不工作。
【问题讨论】:
-
I[im == 5]是什么意思?您想将 所有 像素(例如 [1,0,0])更改为 [200,0,0] 吗? -
我编辑问题:我想将所有等于 10 的像素更改为红色值 [1,0,0]。
标签: python image image-processing grayscale