Advertisement
Lexxx1010

Untitled

Jun 15th, 2021
1,084
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. from PIL import Image
  2. import numpy as np
  3. import matplotlib.pyplot as plt
  4.  
  5. image = np.asarray(Image.open("text.png"))
  6. q = []
  7. for i in range(100):
  8.     for j in range(100):
  9.         if (int(image[i][j][0]) + int(image[i][j][1]) + int(image[i][j][2]) != 765):
  10.             q.append([(j)/20 + np.random.uniform(-0.025, 0.025), (100-i)/20 + np.random.uniform(-0.025, 0.025)])
  11. qq = np.array(q, dtype=np.float32)
  12. with open("iad4.csv", "w") as out:
  13.     np.savetxt(out, qq, fmt="%f", delimiter=",")
  14.  
  15. plt.scatter(qq[:, 0], qq[:, 1])
  16. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement