Skip to content
Snippets Groups Projects
Commit 743e1cc3 authored by Kinadinova Dariya's avatar Kinadinova Dariya
Browse files

liste_col

parent 6735258c
Branches
No related tags found
No related merge requests found
from PIL import Image, ImageDraw
# im = Image.open("calbuth.png")
# im_rgb = im.convert('RGB')
def decouper(im: Image, file: str):
"""à_remplacer_par_ce_que_fait_la_fonction
def decouper(file: str) -> list[Image]:
"""splits image into four blocks
Précondition :
Exemple(s) :
......@@ -23,4 +21,8 @@ def decouper(im: Image, file: str):
crop3 = (0, (h//2), (w//2), h)
block_3 = im.crop(crop3)
crop4 = ((h//2), (w//2), h, w)
block_4 = im.crop(crop4)
\ No newline at end of file
block_4 = im.crop(crop4)
l = [block_1, block_2, block_3, block_4]
return l
......@@ -28,23 +28,13 @@ def avg_col(l:list[int]) -> list[int]:
avg3 = c3 / n_col
return (avg1, avg2, avg3)
def is_close(c1: int, c2: int, seuil: int) -> bool:
"""savoir si deux couleurs sont proches
def liste_col(im: Image, left_top: tuple(int), right_bottom: tuple(int)) -> list[int]:
"""à_remplacer_par_ce_que_fait_la_fonction
Précondition :
Exemple(s) :
$$$
"""
dist_2 = 0
for i in range(3):
dist_2 = dist_2 + (c1[i] - c2[i]) ** 2
distance = dist_2 ** 0.5
return distance < seuil
\ No newline at end of file
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment