我想用opencv将白色改成红色,保持黑色部分的颜色,怎么做?
你可以努力做到这一点。
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](红色)的所有像素