I'm a beginner working on an Opencv project for the very first time. I wrote the program below to convert white pixels in a RGB image to black ones but the error as shown in the title appeared. It would be great if you could explain to me on what has went wrong and how I can make it work. Any help is appreciated.
import cv2
import numpy as np
image = cv2.imread("MAP.png")
print ("Your image has been opened.")
cv2.imshow("Image", image)
x,y = image [0:500,0:500]
print (image[297,365])
e = image[:,:,0]
r = image[:,:,1]
t = image[:,:,2]
image = [e,r,t]
for i in range (x,y):
if [e,r,t] == [255,255,255]:
[e,r,t] = [0,0,0]
print (image[297,365])
cv2.waitKey(0)
cv2.destroyAllWindows()
x,y = image[0:500,0:500]... not really sure what the author had in mind when they wrote that, doesn't really make sense. - Dan MaĊĦek