lower_green = np.array([0,200,0])
upper_green = np.array([100,255,100])
img=np.zeros((2,2,3))
for pos in img:
for color in pos:
color = lower_green
print(color)
#
print(img)
plt.imshow(img)
>> [ 0 200 0]
[ 0 200 0]
[ 0 200 0]
[ 0 200 0]
>>[[[ 0. 0. 0.]
[ 0. 0. 0.]]
[[ 0. 0. 0.]
[ 0. 0. 0.]]]
为什么矩阵没有改变呢,如果采用 color[0]=lower_green[0]就可以改变 img 矩阵