Unable to detect black pixels ?
I am reading a picture to color in red all its black pixels (the background only is black):
import numpy as np
import cv2
second=cv2.imread('second.png')
for i in range(second.shape[0]):
for j in range(second.shape[1]):
if second[i,j,0]!=0 and second[i,j,1]!=0 and second[i,j,2]!=0:
second[i,j,0]=0
second[i,j,1]=0
second[i,j,2]=255
cv2.imwrite('result.png',second)
Here is the image second.png:
Here is the colored image result.png:
Why not all the yellow rose is not colored in red ? Note when I print those pixels that are not colored (in red in result.png) in second.png I see they are not black. Why this ?