Reputation:
I first binarized an image and then filtered it in python.
Now how can I add every pixel> 0 to a numpy array?
img = Image.open('native.png').convert('RGB')
binarised = img.convert('LA')
# binarised.save('binarised.png')
filtered = ndimage.median_filter(binarised, size = 27)
# Image.fromarray(filtered).save('filtered.png')
width, height = img.size
x = np.array([])
y = np.array([])
for column in range(width):
for line in range(height):
if(???): ### if pixel at column/line > 0 ###
x = np.append(x, column)
y = np.append(y, line)
Upvotes: 1
Views: 386