added ex25

gol
Daniel Knüttel 2019-02-19 14:13:20 +01:00
parent 7cde3c597a
commit 99aa707873
2 changed files with 28 additions and 0 deletions

BIN
exam/ex25/input.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

28
exam/ex25/main.py 100644
View File

@ -0,0 +1,28 @@
import numpy as np
from scipy import misc
image = misc.imread("input.png")
N = min(image.shape[:-1])
image = image[:N, :N, :]
old_image = image.copy()
this_image = np.zeros(image.shape)
i = 0
print()
while((this_image != image).any()):
for x in range(N):
for y in range(N):
this_image[x, y] = old_image[(2*x + y) % N, (x + y) % N]
old_image = this_image.copy()
i += 1
print(i / (3*N), "%", " "*15, end="\r", flush=True)
misc.imsave("output/{}.png".format(i), this_image)
print()