[9e019c]: / ecgSignalsToImage.py

Download this file

14 lines (11 with data), 431 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
for count, i in enumerate(array):
fig = plt.figure(frameon=False)
plt.plot(i)
plt.xticks([]), plt.yticks([])
for spine in plt.gca().spines.values():
spine.set_visible(False)
filename = directory + '/' + str(count)+'.png'
fig.savefig(filename)
im_gray = cv2.imread(filename, cv2.IMREAD_GRAYSCALE)
im_gray = cv2.resize(im_gray, (128, 128), interpolation = cv2.INTER_LANCZOS4)
cv2.imwrite(filename, im_gray)