Skip to content

Commit 08f2031

Browse files
authored
Update compress_utils.py
1 parent 397d972 commit 08f2031

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

compress_utils.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,11 @@ def assign_chunks_to_var(chunk_index,img_slices,Indices):
6060
def slice_image(image,r=4,c=4):
6161

6262
rows,cols = image.shape[:2]
63-
while True:
64-
if (rows%r==0 or rows%r>1) : #making sure there arent any 1x1 chunks
65-
break
66-
else: r+=1
67-
68-
while True:
69-
if cols%c==0 or cols%c>1 :
70-
break
71-
else: c+=1
63+
while rows % r == 1:
64+
r += 1 #making sure there arent any 1x1 chunks
65+
66+
while cols % c == 1:
67+
c += 1
7268

7369
indices=np.arange(0,rows*cols).reshape(rows,cols)
7470
l=[];m=0;n=0;I=[]

0 commit comments

Comments
 (0)