I'm trying to write a file with many array ,every array in 1 line, and after that I need to use this data but in 2 category the firsts elements of the array are the input data and the others are the output but when I write this code I got nothing just white lines
here is my code:
IM = np.array(image)
img = Image.open('Image.bmp')
R = img.crop((235, 100, 255, 120))
for j in range(20):
for i in range(20):
[r, v, b] = R.getpixel((i, j))
s = [r, v, b]
A = [1, 0, 0]
v = s + A
f = open("C:image echantillonDATAT12", 'a')
f.writelines(str(v) + "
")
f.close()
f = open("C:image echantillonDATAT12", 'r')
H = f.read()
X = np.array(3)
Y = np.array(3)
for ligne in H:
X = np.array(ligne[0:2])
Y = np.array(ligne[3:5])
f.close()
for i in range (3):
print (X, Y)
and this is my file:
[161, 118, 140, 1, 0, 0]
[51, 56, 80, 1, 0, 0]
[21, 23, 22, 1, 0, 0]
[14, 17, 18, 1, 0, 0]
[14, 15, 12, 1, 0, 0]
[14, 15, 10, 1, 0, 0]
[14, 15, 9, 1, 0, 0]
question from:
https://stackoverflow.com/questions/65882110/how-to-load-file-as-array