I´ve written a function that saves the color values of 108 pictures for each single pixel. The problem is, the output data takes way to much space on a microcontroller. That is why i want to decrease the amount taken.
The second value in the write line "20" means 20 miliseconds. Currently every 20 milliseconds each of the values is processed again and stored. A lot of the values are Similar (225,225,225 -> 223,223,223) etc. Now I want to merge more than one value together and create some kind of value' (arritmetic average probably). For each time, that i safe up one value, i need to increase the miliseconds it is displayed.
Now to my question, how do I compare the first value to the last 10 or so? and how can i exchange the values, so that i can process further.
`
images = [cv2.imread(file) for file in glob.glob("small/*.jpg")] #Ordner anpassen!
counter = 0
arrayOfIndex =[0]
file2 = open("test.csv", "a")
# y,x,z = images[1]
y=39 # size of the Matrix-Y-Axis
x=20 # size of the Matrix-X-Axis
file2.write("/* All Array Headerinformation is at the bottom of the file. */")
file2.write( "{\n")
for j in range(0,y):
for i in range(0,x):
for pic in images:
blue = pic[j, i, 0]
green = pic[j, i, 1]
red = pic[j, i, 2]
file2.write( "{" + "0" + "," + "20" + "," + str(red) +"," + str(green) + "," + str(blue) + "}," + "\n")
counter+=1
file2.write( "{" + "255" + "," + "255" + "," + "0" +"," + "0" + "," + "0" + "}," + "\n\n")
counter+=1
arrayOfIndex.append(counter)
file2.write( "}\n")
del arrayOfIndex[-1]
res = str(arrayOfIndex)[1:-1] #dadurch wird die liste ohne eckige Klammern gespeichert
file2.write("uint16_t Video_IndexTable[" + str(len(arrayOfIndex)) + "] = {" + res + "};\n")
file2.write("const uint8_t Video["+ str(counter) +"][5] PROGMEM =")
#hier muss Index Tabelle und so rein
file2.close
print("Fertig!")
`
I allready tried to write three nestes IF statements, but this didn´t seem right. Then I tried comparing the values of the File, but i had excepion issues(comparing the second value to the last three).