import numpy as np from PIL import Image import matplotlib.pyplot as plt import cv2 img = cv2.cvtColor(cv2.imread('test.jpg'), cv2.COLOR_BGR2GRAY) img = cv2.GaussianBlur(img, (15, 15), 0) # poprawia jakosc img = cv2.resize(img, (8, 8), interpolation=cv2.INTER_AREA) print(type(img)) print(img.shape) print(img) plt.imshow(img ,cmap='binary') plt.show() data = [] rows, cols = img.shape for i in range(rows): for j in range(cols): k = img[i, j] if k > 200: k = 0 # brak czarnego else: k = 1 data.append(k) print(data)