diff --git a/exam/ex25/input.png b/exam/ex25/input.png new file mode 100644 index 0000000..be5978b Binary files /dev/null and b/exam/ex25/input.png differ diff --git a/exam/ex25/main.py b/exam/ex25/main.py new file mode 100644 index 0000000..c2ba156 --- /dev/null +++ b/exam/ex25/main.py @@ -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()