added ex25
This commit is contained in:
parent
7cde3c597a
commit
99aa707873
BIN
exam/ex25/input.png
Normal file
BIN
exam/ex25/input.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
28
exam/ex25/main.py
Normal file
28
exam/ex25/main.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user