Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- import numpy as np
- with open("vl53l5cx_16x16_w_obstacle.txt") as f:
- lines = f.readlines()
- imageNumber = int(input("Введите номер изображения: "))
- line = lines[imageNumber].replace("\n", "").split(",")
- # convert string array to
- intArray = [int(n) for n in line]
- w, h = 8, 8
- matrix = np.zeros((h, w), dtype=np.uint8)
- count = 0
- for i in range(0, 64, 8):
- matrix[count] = intArray[i:i+8]
- count += 1
- print(matrix)
- img = Image.fromarray(matrix, 'L')
- img.save('my.png')
- img.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement