diff --git a/projet/Decouper_Image.py b/projet/Decouper_Image.py index b25e02153c508e8633695e4686e9a514f207b535..a5ffdbdaaf780c79eb1dbdab4343d5fe81d6e420 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 a480e5dbfe8c89c4e52730e80f45a6d7d6b3c8c8..e92031c3cc3a11cd13adff79a19614245d1bddb0 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)