You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
306 B

from tqdm import tqdm
def optimize(pxls, back):
old_len = len(pxls)
new_pxls = []
for i in tqdm(range(old_len)):
el = pxls[i]
now_back = [el[2], el[3], el[4]]
if now_back != back:
new_pxls.append(pxls[i])
print(f"Optimized {(old_len - len(new_pxls)) / old_len * 100 }%")
return new_pxls