So this is my code. I don't want to get all the coordinates of pixel values below 210 because I want to perform some operation on them and possibly adjust the condition depending on outcome of that operation.
filename = "/home/User/PycharmProjects/Test/files/1366-000082.png"
image = Image.open(filename)
image_data = np.asarray(image, dtype='int64')
def get_image_data():
for row in image_data:
for cell in row:
if condition:
# I need only coordinate of cell here
So again I am aware of the argwhere function. But that only gets me all the coordinates. But I might want to change that condition somewhere in the loop.
Is this even possible?
Otherwise I have to use Pillow, but then the loop will be 10x slower.