fork download
  1. import PIL
  2. from operator import sub
  3. from typing import List, Tuple
  4. from PIL import Image
  5.  
  6.  
  7. def tuple_dif(right_image_rbga: tuple, left_image_rbga: tuple) -> tuple:
  8. return tuple(map(lambda r, l: abs(r-l), right_image_rbga, left_image_rbga))
  9.  
  10.  
  11. def sum_and_div_one(lst):
  12. sm = sum(map(sum, lst))
  13. return sm / 3136
  14.  
  15.  
  16. diff = list()
  17. for i in range(1, 19):
  18. with Image.open(f'My Hero Academia/278/{i}.png') as img1, Image.open(f'My Hero Academia/278/{i+1}.png') as img2:
  19. for y in range(0, 1145):
  20. right_img_rgba = img1.getpixel((0, y))
  21. lefty_img_rgba = img1.getpixel((783, y))
  22. diff.append(tuple_dif(right_img_rgba, lefty_img_rgba))
  23. print(f'i:{i}-{i+1}')
  24. print(sum_and_divide(diff))
  25. diff = list()
  26.  
  27.  
Runtime error #stdin #stdout #stderr 0.03s 62912KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
  File "prog.py", line 7
    def tuple_dif(right_image_rbga: tuple, left_image_rbga: tuple) -> tuple:
                                  ^
SyntaxError: invalid syntax (expected ')')