I am trying to make the black and white mask. Below image has mask of yellow color of chair. I am making it to white and else everything as black. I have used this color [220, 211, 81] for a mask. If i am finding this pixel color it shows that there is nothing like this. What am i doing wrong ? Code:
import cv2
color_to_seek = [220, 211, 81]
original = cv2.imread('image.png')
original = cv2.cvtColor(original, cv2.COLOR_BGR2RGB)
amount = 0
for x in range(original.shape[0]):
for y in range(original.shape[1]):
r, g, b = original[x, y]
if (r, g, b) == color_to_seek:
amount += 1
print(amount)`
Image:
I am expecting that yellow mask should replaced by white pixels and everything as black. Is there a difference between mask or pixel color ?. Elaborate little bit ?