I have a grayscale image here and I am trying to convert it to numpy array so I can utilise argwhere function to locate coordinates (x,y) of pixels with intensity of 255 (white).
So far I have the following:
photo = filedialog.askopenfilename(initialdir="/", title="Select file", filetypes=(("png files", "*.png"), ("all files", "*.*")))
img = PIL.Image.open(photo).convert('L')
I have tried np.asarray(img) but it just returns:
[[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
...
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]]
At this stage I'm afraid I am stuck on what to do next, so any help would be much appreciated. Thanks!