diff --git a/projet/codes/color_manipulation.py b/projet/codes/color_manipulation.py index 99b8b104a562a3723153f4974a3a0b641cdf377a..feeefcc19a9bc9f60b78478f5ecbb1e6c3a6e0f9 100644 --- a/projet/codes/color_manipulation.py +++ b/projet/codes/color_manipulation.py @@ -46,17 +46,17 @@ def avg_col(l:list) -> tuple(): (236, 210, 111) """ - c1 = 0 - c2 = 0 - c3 = 0 + r = 0 + g = 0 + b = 0 for col in l: - c1 += col[0] - c2 += col[1] - c3 += col[2] - avg1 = c1 // len(l) - avg2 = c2 // len(l) - avg3 = c3 // len(l) - return (avg1, avg2, avg3) + r += col[0] + g += col[1] + b += col[2] + avg_r = r // len(l) + avg_g = g // len(l) + avg_b = b // len(l) + return (avg_r, avg_g, avg_b) def list_col(im: Image, left_top: tuple(), right_bottom: tuple()) -> list[int]: """Renvoie une liste de tuples de couleurs pour chaque pixel de la région spécifiée de l'image.