Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
246 B
1
Indexable
Never
n = np.array(img)
bw = np.zeros((len(n), len(n[0])))
n = n.astype('uint16')
for i in range(0, len(n)):
  for j in range(0, len(n[0])):
    avrg = (n[i][j][0] + n[i][j][1]+ n[i][j][2]) / 3
    bw[i][j]= avrg

plt.imshow(bw, cmap='Greys_r')
Leave a Comment