forked from ikarth/wfc_2019f
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deformed_iron_wfc_run.py
46 lines (34 loc) · 1.29 KB
/
deformed_iron_wfc_run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
"""Deformed Iron WFC Run
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1Xc_9KgHzF8TYEPADLw4mm7QWjMmkM5uR
"""
!python -m pip install git+https://github.com/cemel-jhu/WaveFunctionCollapse
!mkdir -p /content/images/samples/
!mkdir -p /content/output
from PIL import Image
import numpy as np
img = Image.open("images/samples/IPF-X.png")
dir(img)
resized = img.resize((32, 32))
reduced = resized.convert('P', palette=Image.ADAPTIVE, colors=6)
image = reduced.convert("RGB")
import wfc.wfc_control as wfc_control
result = wfc_control.execute_wfc(
image = np.array(image),
# filename="IPF-X",
tile_size=2,
pattern_width=1,
output_size=[32, 32],
attempt_limit=100,
output_periodic=True,
input_periodic=False,
log_filename="out.log",
backtracking=True,
visualize=False,
logging=True,
)
import matplotlib.pyplot as plt
plt.imshow(result)
np.save("test1result",result)