Skip to content
Snippets Groups Projects
Commit 684c6e95 authored by Melissa Belkacemi's avatar Melissa Belkacemi
Browse files

Update quatre_blocs

parent 95ca2ce4
Branches
No related tags found
No related merge requests found
......@@ -32,13 +32,15 @@ def quatre_blocs(im:Image,hg:tuple[int,int],bd:tuple[int,int])->tuple[Bloc,Bloc,
"""découpe une image en 4 blocs
"""
x1,y1=hg
x2,y2=bd
pixel_hg1=hg
pixel_bd1=((bd[0]+hg[0])//2,(bd[1]+hg[1])//2)
pixel_hg2=((bd[0]+hg[0])//2,hg[1])
pixel_bd2=(bd[0],(bd[1]+hg[1])//2)
pixel_hg3=(hg[0],(bd[1]+hg[1])//2)
pixel_bd3=((bd[0]+hg[0])//2,bd[1])
pixel_hg4=((bd[0]+hg[0])//2,(bd[1]+hg[1])//2)
pixel_bd1=((x1+x2)//2,(y1+y2)//2)
pixel_hg2=(1+(x1+x2)//2,y1)
pixel_bd2=(x2,(y1+y2)//2)
pixel_hg3=(x1,1+(y1+y2)//2)
pixel_bd3=((x1+x2)//2,y2)
pixel_hg4=(1+(x1+x2)//2,1+(y1+y2)//2)
pixel_bd4=bd
couleurs1=[im.getpixel((i,j)) for i in range(pixel_hg1[0],1+pixel_bd1[0]) for j in range(pixel_hg1[1],1+pixel_bd1[1])]
couleurs2=[im.getpixel((i,j)) for i in range(pixel_hg2[0],1+pixel_bd2[0]) for j in range(pixel_hg2[1],1+pixel_bd2[1])]
......@@ -53,4 +55,4 @@ t=im.size
hg=(0,0)
bd=(t[0]-1,t[1]-1)
im_rgb = im.convert('RGB')
b=decoupe(im_rgb,hg,bd,1)
\ No newline at end of file
b=decoupe(im_rgb,hg,bd,1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment