I have an array (called 'img') that I want to modify.
img
array([[[244, 244, 244],
[248, 248, 248],
[249, 249, 249],
I want to change the values in the array to 0 if they are below 200 and convert to 255 if they are above or equal to 200:
for value in img:
if value < 200:
value = 0
else:
value = 255
However, I am getting this error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
How can I get this code to work?
valueis a list as well.