I'm trying to change the color of a certain image to a new color. But when running the code below. The following error appears:
Traceback (most recent call last) File "/home/vagner/PycharmProjects/TestesDeBorda/DesenharRetangulo.py", line 16, in
if (image[i, j] > minCorAgua - image[i, j] < maxCorAgua).all():
ValueError: The truth value of an array with more than one element is ambiguous. Use
a.any()
ora.all()
import cv2
minCorAgua = (108,110,115)
maxCorAgua = (166,163,162)
i = 0
j = 0
#video = cv2.VideoCapture('TesteVideoMelhor.MOV')
#ret, frame = video.read()
imagem = cv2.imread('PegarPixelsDaAgua.png')
while(i < imagem.shape[1]):
while(j < imagem.shape[0]):
if (imagem[i,j] > minCorAgua and imagem[i,j] < maxCorAgua):
imagem[i,j] = (255,255,255)
j = j + 1
i = i + 1
cv2.imshow('teste', imagem)