I have one picture read with OpenCV lib in Python.
Im wondering, how can I change background color to white. I just want to have persons from the image and white background.
For example:
I want to change to this:
How can I do such thing:
import numpy as np
import cv2
my_image = r'C:\Users\Pc\Desktop\preklapanje4.jpg'
my_image = cv2.imread(my_image, 1)
cv2.imshow('img',my_image)
cv2.waitKey(0)
解决方案
In this image, you need to flood fill in several regions, since all the background green color is not connected.
import cv2
import numpy as np