To jest stara wersja strony!
narzędzia wykorzystane:
$$ \frac{1}{f} = \frac{1}{o} + \frac{1}{i} $$
Gdzie:
Skrypt w pythonie obliczający sumę wszystkich różnic pomiędzy parami pikseli w obrazku.
from PIL import Image import os import sys def main(): img_path = os.path.join(os.getcwd(), "greyscale.png") if not os.path.isfile(img_path): print(f"Error: File not found: {img_path}") sys.exit(1) img = Image.open(img_path).convert('L') pixels = list(img.getdata()) n = len(pixels) total = 0 for i in range(n): pi = pixels[i] for j in range(i + 1, n): total += pi - pixels[j] print(f"Loaded: {img_path}") print(f"Total pixels: {n}") print(f"Sum of abs differences over all pairs: {total}") if __name__ == "__main__": main()