Change color of a pixel with OpenCV
问题 Let say I have this rose (Do not care about the background, only the white leaves are important). I transform it to a grayscale picture: grayscaled=cv2.imread('white_rose.png',cv2.IMREAD_GRAYSCALE) How can I change every white pixel to a red one under the condition the red color ( R=255 ) will have the same contrast as the white one has ? Meaning I want to see the white leaves in red color but with the same L value of every pixel that in grayscaled ? 回答1: You need to loop over your grey image