how to change color of image in opencv

Solutions on MaxInterview for how to change color of image in opencv by the best coders in the world

showing results for - "how to change color of image in opencv"
Emilia
24 Mar 2020
1# if you want to change color while reading the image, set flag=0 for Grayscale
2img = cv2.imread("example.png", flag=0)
3
4# if you want to change color of a pre-loaded image (Grayscale)
5# chnage the code parameter accordingly, here it turns into grayscale
6img = cv2.cvtColor(img, code=cv2.COLOR_BGR2GRAY)