From 7a6a97cfc90e10aaa69da489f02e2520d48a94a6 Mon Sep 17 00:00:00 2001
From: Kinadinova Dariya <dariya.kinadinova.etu@115p4.fil.univ-lille.fr>
Date: Wed, 27 Mar 2024 12:54:35 +0100
Subject: [PATCH] is_col_close

---
 projet/Decouper_Image.py | 15 ++++++++++++---
 projet/ex.py             |  2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/projet/Decouper_Image.py b/projet/Decouper_Image.py
index b25e021..a5ffdbd 100644
--- a/projet/Decouper_Image.py
+++ b/projet/Decouper_Image.py
@@ -46,7 +46,6 @@ def avg_col(l:list) -> tuple():
     avg3 = c3 // len(l)
     return (avg1, avg2, avg3)
 
-
 def list_col(im: Image, left_top: tuple(), right_bottom: tuple()) -> list[int]:
     """à_remplacer_par_ce_que_fait_la_fonction
 
@@ -65,10 +64,20 @@ def is_col_close(color1: tuple(), color2: tuple()) -> bool:
     returns False if the distance is more than 30
 
     Précondition : 
-    Exemple(s) :
-    $$$ 
+    Exemple(s) : 
+    $$$ is_col_close((230, 210, 210), (236, 210, 211))
+    True
+    $$$ is_col_close((66, 135, 245), (103, 179, 82))
+    False
 
     """
+    if (abs(color1[0] - color2[0]) <= 30) and (abs(color1[1] - color2[1]) <= 30) and (abs(color1[2] - color2[2]) <= 30):
+        res = True
+    else:
+        res = False
+    return res
+        
+    
     
     
 
diff --git a/projet/ex.py b/projet/ex.py
index a480e5d..e92031c 100644
--- a/projet/ex.py
+++ b/projet/ex.py
@@ -9,4 +9,4 @@ cb1 = (0)
 crop_rectangle = (0, (h//2), (w//2), h)
 cropped_im = im.crop(crop_rectangle)
 
-cropped_im.show()
\ No newline at end of file
+print(cropped_im.size)
-- 
GitLab