diff --git a/projet/Block.py b/projet/Block.py index 40e6df1207e426508e6e16219d6f548b0a196c84..b8c1127b0633c5db374d3d48eb78e00a48b6e5f3 100644 --- a/projet/Block.py +++ b/projet/Block.py @@ -1,6 +1,15 @@ - +""" +:author: dariya kinadinova +:date: 03/2024 + +""" + +from PIL import Image, ImageDraw + class Block: - def __init__(self, is_uniform, color, coordinates): + def __init__(self, image): + + def is_uniform_block(self, image): """à_remplacer_par_ce_que_fait_la_fonction Précondition : @@ -8,6 +17,5 @@ class Block: $$$ """ - self.is_uniform = is_uniform - self.color = color - self.coordinates = coordinates \ No newline at end of file + + diff --git a/projet/Decouper_Image.py b/projet/Decouper_Image.py new file mode 100644 index 0000000000000000000000000000000000000000..aa2cfa6275e6784fdd365d117ca1b5fa2925759f --- /dev/null +++ b/projet/Decouper_Image.py @@ -0,0 +1,19 @@ +from PIL import Image, ImageDraw + +# im = Image.open("calbuth.png") +# im_rgb = im.convert('RGB') + +def decouper(order: int, im: Image, file: str): + """à_remplacer_par_ce_que_fait_la_fonction + + Précondition : + Exemple(s) : + $$$ + + """ + im = Image.open(file) + im_rgb = im.convert('RGB') + size = im.size + if order != 0: + block_1, block_2, block_3, block_4 = ( + \ No newline at end of file diff --git a/projet/ReadMe.md b/projet/ReadMe.md index e455e2999d3f840e928a21dc46d725b4c9494246..b1c9bc24cdaf2d60f7eff840fd0b932d187469cc 100644 --- a/projet/ReadMe.md +++ b/projet/ReadMe.md @@ -8,5 +8,5 @@ #### **13/03/24 :** - J'ai commencé à travailler sur la classe Block (j'ai commencé par _ _ init _ _ et j'ai ajouté les paramètres pour is_uniform, color et coordinates) et j'ai créé deux fonctions pour la manipulation des couleurs (pour la moyenne des couleurs et leur distance). - - +#### **20/03/24 :** +- Work on Block.py and Decouper_Image.py diff --git a/projet/image.py b/projet/color.py similarity index 70% rename from projet/image.py rename to projet/color.py index ca0449fc0ac444c0ad3c34aeb31ae0f774952b73..ee5d33e88ca371aca9d17f831f79cce24284ff9f 100644 --- a/projet/image.py +++ b/projet/color.py @@ -28,7 +28,7 @@ def avg_col(l:list[int]) -> list[int]: avg3 = c3 / n_col return (avg1, avg2, avg3) -def close_col(c1: int, c2: int, seuil: int) -> bool: +def is_close(c1: int, c2: int, seuil: int) -> bool: """savoir si deux couleurs sont proches Précondition : @@ -41,20 +41,9 @@ def close_col(c1: int, c2: int, seuil: int) -> bool: dist_2 = dist_2 + (c1[i] - c2[i]) ** 2 distance = dist_2 ** 0.5 return distance < seuil + + -# class Block -class Block: - def __init__(self, is_uniform, color, coordinates): - """à_remplacer_par_ce_que_fait_la_fonction - - Précondition : - Exemple(s) : - $$$ - - """ - self.is_uniform = is_uniform - self.color = color - self.coordinates = coordinates diff --git a/projet/file.bmp b/projet/file.bmp new file mode 100644 index 0000000000000000000000000000000000000000..4ee834ecdae2cf72843a0995570c9ca7938dbd8b Binary files /dev/null and b/projet/file.bmp differ