如何在图片中将白色更改为红色?

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

我想用opencv将白色改成红色,保持黑色部分的颜色,怎么做? enter image description here

python opencv
1个回答
3
投票

你可以努力做到这一点。

image = np.zeros((400,400,3), dtype="uint8")
image[np.where((image==[0,0,0]).all(axis=2))] = [0,0,255]

这将更改图像中值为[0,0,0]到[0,0,255](红色)的所有像素

© www.soinside.com 2019 - 2024. All rights reserved.