在python的rgb图像中更改颜色

问题描述 投票:-2回答:1

我有一个图像(我以numpy或PIL格式都有它,我想将rgb值从[0.4,0.4,0.4]更改为[0.54,0.27,0.07]。通过这样做,我想将道路颜色从灰色更改为棕色。您能帮我这个忙吗?

road

python numpy colors python-imaging-library rgb
1个回答
0
投票

您可以尝试这种numpy方法:

img[np.where(img == (0.4,0.4,0.4))] = (0.54,0.27,0.27)
© www.soinside.com 2019 - 2024. All rights reserved.