更改RGB图像中的颜色 [英] Change color in RGB images
本文介绍了更改RGB图像中的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一张图片(同时有NumPy和PIL格式的图片),我想将RGB值从[0.4, 0.4, 0.4]
更改为[0.54, 0.27, 0.07]
的位置.
I have an image (I have it in both NumPy and PIL format), and I want to change where RGB values are [0.4, 0.4, 0.4]
to [0.54, 0.27, 0.07]
.
这样做,我想将道路颜色从灰色更改为棕色:
By doing this, I want to change the road color from gray to brown:
推荐答案
您可以尝试以下numpy方法:
You can try this numpy approach:
img[np.where(img == (0.4,0.4,0.4))] = (0.54,0.27,0.27)
这篇关于更改RGB图像中的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文