-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDU.py
More file actions
17 lines (16 loc) · 752 Bytes
/
DU.py
File metadata and controls
17 lines (16 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def down(img):
result = [[0 for row in range(int(img.dimensions[1]/2))] for column in range(int(img.dimensions[0]/2))]
for i in range(int(img.dimensions[0]/2)):
for j in range(int(img.dimensions[1]/2)):
result[i][j] = img.matrix[i*2][j*2]
return result
def up(img):
result = [[0 for row in range(img.dimensions[1])] for column in range(img.dimensions[0])]
for i in range(int(img.dimensions[0]/2)):
for j in range(int(img.dimensions[1]/2)):
# result[i][j] = img.matrix[i][j]
result[i*2][j*2] = img.matrix[i][j]
result[i*2+1][j*2] = img.matrix[i][j]
result[i*2][j*2+1] = img.matrix[i][j]
result[i*2+1][j*2+1] = img.matrix[i][j]
return result