├── templates ├── images │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ ├── 9.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 17.png │ ├── 18.png │ ├── 19.png │ ├── 20.png │ ├── 21.png │ ├── 22.png │ ├── 23.png │ ├── 24.png │ ├── 25.png │ ├── 26.png │ ├── 27.png │ ├── 28.png │ ├── 29.png │ ├── 30.png │ ├── 31.png │ ├── 32.png │ ├── 33.png │ ├── 34.png │ ├── 35.png │ ├── 36.png │ ├── 37.png │ ├── 38.png │ ├── 39.png │ ├── 40.png │ ├── 41.png │ ├── 42.png │ ├── 43.png │ ├── 44.png │ ├── 45.png │ ├── 46.png │ ├── 47.png │ ├── fern.png │ └── triangle.png └── ifs │ ├── 11.csv │ ├── 12.csv │ ├── 5.csv │ ├── 1.csv │ ├── 10.csv │ ├── 13.csv │ ├── 14.csv │ ├── 18.csv │ ├── 19.csv │ ├── 20.csv │ ├── 22.csv │ ├── 23.csv │ ├── 24.csv │ ├── 25.csv │ ├── 27.csv │ ├── 28.csv │ ├── 29.csv │ ├── 3.csv │ ├── 30.csv │ ├── 31.csv │ ├── 32.csv │ ├── 33.csv │ ├── 34.csv │ ├── 35.csv │ ├── 36.csv │ ├── 37.csv │ ├── 38.csv │ ├── 4.csv │ ├── 41.csv │ ├── 42.csv │ ├── 43.csv │ ├── 46.csv │ ├── 47.csv │ ├── 9.csv │ ├── 21.csv │ ├── 26.csv │ ├── triangle.csv │ ├── 15.csv │ ├── 16.csv │ ├── 17.csv │ ├── 2.csv │ ├── 44.csv │ ├── 6.csv │ ├── 7.csv │ ├── 8.csv │ ├── 39.csv │ ├── fern.csv │ ├── 45.csv │ └── 40.csv ├── assets ├── auxiliary │ ├── color.jpg │ ├── lava.jpg │ ├── lsd2.jpg │ ├── wheat.jpg │ ├── texture1.jpg │ └── van_gogh.jpg └── generated │ ├── lava_5_2.png │ ├── color_22_1.png │ ├── color_27_1.png │ ├── lava_22_1.png │ ├── lava_27_1.png │ ├── lava_34_1.png │ ├── lsd2_30_1.png │ ├── lsd2_43_6.png │ ├── wheat_43_2.png │ ├── texture1_42_2.png │ └── van_gogh_39_1.png ├── requirements.txt ├── LICENSE ├── src ├── render.py ├── io.py ├── ifs.py └── chaos_game.py ├── run.py └── README.md /templates/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/1.png -------------------------------------------------------------------------------- /templates/images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/2.png -------------------------------------------------------------------------------- /templates/images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/3.png -------------------------------------------------------------------------------- /templates/images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/4.png -------------------------------------------------------------------------------- /templates/images/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/5.png -------------------------------------------------------------------------------- /templates/images/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/6.png -------------------------------------------------------------------------------- /templates/images/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/7.png -------------------------------------------------------------------------------- /templates/images/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/8.png -------------------------------------------------------------------------------- /templates/images/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/9.png -------------------------------------------------------------------------------- /templates/images/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/10.png -------------------------------------------------------------------------------- /templates/images/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/11.png -------------------------------------------------------------------------------- /templates/images/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/12.png -------------------------------------------------------------------------------- /templates/images/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/13.png -------------------------------------------------------------------------------- /templates/images/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/14.png -------------------------------------------------------------------------------- /templates/images/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/15.png -------------------------------------------------------------------------------- /templates/images/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/16.png -------------------------------------------------------------------------------- /templates/images/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/17.png -------------------------------------------------------------------------------- /templates/images/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/18.png -------------------------------------------------------------------------------- /templates/images/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/19.png -------------------------------------------------------------------------------- /templates/images/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/20.png -------------------------------------------------------------------------------- /templates/images/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/21.png -------------------------------------------------------------------------------- /templates/images/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/22.png -------------------------------------------------------------------------------- /templates/images/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/23.png -------------------------------------------------------------------------------- /templates/images/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/24.png -------------------------------------------------------------------------------- /templates/images/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/25.png -------------------------------------------------------------------------------- /templates/images/26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/26.png -------------------------------------------------------------------------------- /templates/images/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/27.png -------------------------------------------------------------------------------- /templates/images/28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/28.png -------------------------------------------------------------------------------- /templates/images/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/29.png -------------------------------------------------------------------------------- /templates/images/30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/30.png -------------------------------------------------------------------------------- /templates/images/31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/31.png -------------------------------------------------------------------------------- /templates/images/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/32.png -------------------------------------------------------------------------------- /templates/images/33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/33.png -------------------------------------------------------------------------------- /templates/images/34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/34.png -------------------------------------------------------------------------------- /templates/images/35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/35.png -------------------------------------------------------------------------------- /templates/images/36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/36.png -------------------------------------------------------------------------------- /templates/images/37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/37.png -------------------------------------------------------------------------------- /templates/images/38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/38.png -------------------------------------------------------------------------------- /templates/images/39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/39.png -------------------------------------------------------------------------------- /templates/images/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/40.png -------------------------------------------------------------------------------- /templates/images/41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/41.png -------------------------------------------------------------------------------- /templates/images/42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/42.png -------------------------------------------------------------------------------- /templates/images/43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/43.png -------------------------------------------------------------------------------- /templates/images/44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/44.png -------------------------------------------------------------------------------- /templates/images/45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/45.png -------------------------------------------------------------------------------- /templates/images/46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/46.png -------------------------------------------------------------------------------- /templates/images/47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/47.png -------------------------------------------------------------------------------- /assets/auxiliary/color.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/auxiliary/color.jpg -------------------------------------------------------------------------------- /assets/auxiliary/lava.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/auxiliary/lava.jpg -------------------------------------------------------------------------------- /assets/auxiliary/lsd2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/auxiliary/lsd2.jpg -------------------------------------------------------------------------------- /assets/auxiliary/wheat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/auxiliary/wheat.jpg -------------------------------------------------------------------------------- /templates/images/fern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/fern.png -------------------------------------------------------------------------------- /assets/auxiliary/texture1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/auxiliary/texture1.jpg -------------------------------------------------------------------------------- /assets/auxiliary/van_gogh.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/auxiliary/van_gogh.jpg -------------------------------------------------------------------------------- /assets/generated/lava_5_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/generated/lava_5_2.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | matplotlib==3.2.2 2 | numpy==1.21.5 3 | scikit_image==0.18.3 4 | skimage==0.0 5 | tqdm==4.64.0 6 | -------------------------------------------------------------------------------- /templates/images/triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/templates/images/triangle.png -------------------------------------------------------------------------------- /assets/generated/color_22_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/generated/color_22_1.png -------------------------------------------------------------------------------- /assets/generated/color_27_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/generated/color_27_1.png -------------------------------------------------------------------------------- /assets/generated/lava_22_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/generated/lava_22_1.png -------------------------------------------------------------------------------- /assets/generated/lava_27_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/generated/lava_27_1.png -------------------------------------------------------------------------------- /assets/generated/lava_34_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/generated/lava_34_1.png -------------------------------------------------------------------------------- /assets/generated/lsd2_30_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/generated/lsd2_30_1.png -------------------------------------------------------------------------------- /assets/generated/lsd2_43_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/generated/lsd2_43_6.png -------------------------------------------------------------------------------- /assets/generated/wheat_43_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/generated/wheat_43_2.png -------------------------------------------------------------------------------- /assets/generated/texture1_42_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/generated/texture1_42_2.png -------------------------------------------------------------------------------- /assets/generated/van_gogh_39_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidsvy/color-stealing/HEAD/assets/generated/van_gogh_39_1.png -------------------------------------------------------------------------------- /templates/ifs/11.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 7.334392052143812180e-03 7.946319580078125000e-01 3 | 7.590246200561523438e-01 2.278033345937728882e-01 4 | 4.050507023930549622e-02 2.890375256538391113e-01 5 | 6 | 4.703440666198730469e-01 -1.757266372442245483e-01 7 | 1.105361953377723694e-01 5.703640580177307129e-01 8 | -8.199586272239685059e-01 8.263300061225891113e-01 9 | 10 | 6.764478683471679688e-01 11 | 3.235521018505096436e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/12.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 7.334392052143812180e-03 7.946319580078125000e-01 3 | -7.685050964355468750e-01 3.267178237438201904e-01 4 | 4.050507023930549622e-02 2.890375256538391113e-01 5 | 6 | 4.703440666198730469e-01 -1.757266372442245483e-01 7 | 1.105361953377723694e-01 5.703640580177307129e-01 8 | -8.199586272239685059e-01 8.263300061225891113e-01 9 | 10 | 6.806147694587707520e-01 11 | 3.193852305412292480e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/5.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 2.334254980087280273e-02 6.501169204711914062e-01 3 | 6.659131646156311035e-01 -1.224135905504226685e-01 4 | -6.431630253791809082e-01 -6.154034733772277832e-01 5 | 6 | 3.703418374061584473e-01 5.111617445945739746e-01 7 | 7.549774646759033203e-01 -2.910165488719940186e-01 8 | 2.555963397026062012e-01 1.961336582899093628e-01 9 | 10 | 4.688465893268585205e-01 11 | 5.311534404754638672e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/1.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -8.296274542808532715e-01 6.054252386093139648e-01 3 | -4.971233010292053223e-01 -7.018672227859497070e-01 4 | -4.543680548667907715e-01 -9.635468125343322754e-01 5 | 6 | 4.080636501312255859e-01 1.821585297584533691e-01 7 | -5.066847205162048340e-01 -2.972498908638954163e-02 8 | -2.769308537244796753e-02 7.390594575554132462e-03 9 | 10 | 9.167894721031188965e-01 11 | 8.321055024862289429e-02 12 | -------------------------------------------------------------------------------- /templates/ifs/10.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 8.458074331283569336e-01 -9.269016981124877930e-01 3 | 3.788162469863891602e-01 5.190823674201965332e-01 4 | 8.204903602600097656e-01 8.688170313835144043e-01 5 | 6 | 4.063149094581604004e-01 -3.720591366291046143e-01 7 | 6.773421913385391235e-02 -4.476743638515472412e-01 8 | -5.049805045127868652e-01 2.093260735273361206e-01 9 | 10 | 8.345111012458801270e-01 11 | 1.654889285564422607e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/13.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -1.642044037580490112e-01 -2.153918892145156860e-01 3 | 4.808998405933380127e-01 -4.813246056437492371e-02 4 | -4.472575187683105469e-01 4.735639393329620361e-01 5 | 6 | -5.385975837707519531e-01 -9.140591025352478027e-01 7 | 8.474999070167541504e-01 -1.415079236030578613e-01 8 | 8.510292768478393555e-01 -7.828009724617004395e-01 9 | 10 | 1.158451661467552185e-01 11 | 8.841548562049865723e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/14.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -6.882113218307495117e-01 -1.876973062753677368e-01 3 | -1.986610293388366699e-01 6.873676180839538574e-01 4 | -6.625474095344543457e-01 -8.756598830223083496e-01 5 | 6 | -2.575953006744384766e-01 5.150293111801147461e-01 7 | 5.279577970504760742e-01 2.796734571456909180e-01 8 | 4.171749353408813477e-01 -6.810858845710754395e-02 9 | 10 | 5.973816514015197754e-01 11 | 4.026183485984802246e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/18.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 6.234437823295593262e-01 -3.099685907363891602e-01 3 | 3.472897112369537354e-01 7.364478111267089844e-01 4 | 2.489053308963775635e-01 -4.925374984741210938e-01 5 | 6 | -5.747297406196594238e-02 8.768686652183532715e-01 7 | -4.572510123252868652e-01 2.401660382747650146e-02 8 | 7.013995647430419922e-01 -7.463864684104919434e-01 9 | 10 | 5.865181684494018555e-01 11 | 4.134818315505981445e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/19.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 9.247775077819824219e-01 -1.520512998104095459e-01 3 | 1.883237212896347046e-01 9.243971705436706543e-01 4 | -8.015809059143066406e-01 5.574151873588562012e-01 5 | 6 | -8.515122532844543457e-01 -1.756912022829055786e-01 7 | 3.945966362953186035e-01 2.050169855356216431e-01 8 | -9.992387294769287109e-01 6.168548464775085449e-01 9 | 10 | 8.935545086860656738e-01 11 | 1.064454764127731323e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/20.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 7.265806198120117188e-01 -4.806926846504211426e-01 3 | -7.605728507041931152e-02 -6.632491350173950195e-01 4 | 5.886316299438476562e-01 2.976033687591552734e-01 5 | 6 | -3.096728026866912842e-01 -4.414948821067810059e-01 7 | -6.363565325736999512e-01 3.774863183498382568e-01 8 | 7.430411577224731445e-01 7.502896785736083984e-01 9 | 10 | 5.658177137374877930e-01 11 | 4.341823160648345947e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/22.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 8.338066935539245605e-02 -5.063601136207580566e-01 3 | 1.102754548192024231e-01 5.418967604637145996e-01 4 | 8.243876099586486816e-01 -1.303137987852096558e-01 5 | 6 | -8.571201562881469727e-01 3.365896940231323242e-01 7 | -1.516855657100677490e-01 -9.772838354110717773e-01 8 | 4.120269417762756348e-01 1.380964964628219604e-01 9 | 10 | 1.020712554454803467e-01 11 | 8.979287743568420410e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/23.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -2.259376458823680878e-02 9.784123301506042480e-01 3 | -3.115171790122985840e-01 -3.659325242042541504e-01 4 | -9.468245506286621094e-01 6.947335004806518555e-01 5 | 6 | 7.079594731330871582e-01 -6.320081353187561035e-01 7 | 1.931725591421127319e-01 7.345713973045349121e-01 8 | 8.623947203159332275e-02 -5.082530379295349121e-01 9 | 10 | 3.277451694011688232e-01 11 | 6.722548007965087891e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/24.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 8.017808794975280762e-01 8.752852678298950195e-03 3 | 2.224664986133575439e-01 7.709530591964721680e-01 4 | -7.819567918777465820e-01 -1.561966352164745331e-02 5 | 6 | 4.639263153076171875e-01 5.782603621482849121e-01 7 | 2.214103490114212036e-01 -4.885432124137878418e-01 8 | 3.366511166095733643e-01 -6.334483027458190918e-01 9 | 10 | 6.346769332885742188e-01 11 | 3.653230667114257812e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/25.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -3.545349240303039551e-01 8.671717643737792969e-01 3 | 9.472966790199279785e-01 3.956187963485717773e-01 4 | -1.271281540393829346e-01 1.114620640873908997e-01 5 | 6 | -1.425288170576095581e-01 2.773476243019104004e-01 7 | 1.350415349006652832e-01 3.245027065277099609e-01 8 | -6.474375128746032715e-01 8.374188840389251709e-02 9 | 10 | 9.199333190917968750e-01 11 | 8.006668090820312500e-02 12 | -------------------------------------------------------------------------------- /templates/ifs/27.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -5.172688961029052734e-01 8.086049556732177734e-01 3 | -7.031580805778503418e-01 -6.020253896713256836e-01 4 | -8.855181932449340820e-01 -1.371643394231796265e-01 5 | 6 | -2.202740758657455444e-01 -2.349525690078735352e-01 7 | 7.467619776725769043e-01 3.101079463958740234e-01 8 | -6.352252364158630371e-01 5.693696141242980957e-01 9 | 10 | 8.914582729339599609e-01 11 | 1.085417196154594421e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/28.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -5.172688961029052734e-01 8.086049556732177734e-01 3 | -7.031580805778503418e-01 -6.020253896713256836e-01 4 | -8.855181932449340820e-01 -1.371643394231796265e-01 5 | 6 | -2.202740758657455444e-01 -2.349525690078735352e-01 7 | 3.090621531009674072e-02 3.101079463958740234e-01 8 | -6.352252364158630371e-01 5.693696141242980957e-01 9 | 10 | 9.351274371147155762e-01 11 | 6.487256288528442383e-02 12 | -------------------------------------------------------------------------------- /templates/ifs/29.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 1.405318230390548706e-01 1.817779392004013062e-01 3 | -2.443236112594604492e-01 1.944032758474349976e-01 4 | 5.380641818046569824e-01 6.097941398620605469e-01 5 | 6 | -9.873664975166320801e-01 -2.109589576721191406e-01 7 | 3.597737550735473633e-01 -8.297297358512878418e-01 8 | -2.706610858440399170e-01 -2.119498401880264282e-01 9 | 10 | 7.418985664844512939e-02 11 | 9.258101582527160645e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/3.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -6.425372362136840820e-01 -5.229954123497009277e-01 3 | -5.218129754066467285e-01 6.367483735084533691e-01 4 | -3.351014554500579834e-01 -1.319093108177185059e-01 5 | 6 | -3.437197506427764893e-01 -2.878506779670715332e-01 7 | -2.133147120475769043e-01 3.519572317600250244e-01 8 | 3.440170288085937500e-01 -4.486494064331054688e-01 9 | 10 | 7.890170216560363770e-01 11 | 2.109829783439636230e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/30.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 1.405318230390548706e-01 1.817779392004013062e-01 3 | -2.443236112594604492e-01 1.944032758474349976e-01 4 | 5.380641818046569824e-01 6.097941398620605469e-01 5 | 6 | -9.873664975166320801e-01 -2.949753403663635254e-01 7 | 3.597737550735473633e-01 -8.297297358512878418e-01 8 | 8.638191819190979004e-01 -2.119498401880264282e-01 9 | 10 | 7.194081693887710571e-02 11 | 9.280591607093811035e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/31.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 4.565810859203338623e-01 4.825285673141479492e-01 3 | 5.303101241588592529e-02 -7.614088058471679688e-01 4 | -3.833527863025665283e-02 -7.562398314476013184e-01 5 | 6 | -1.894747912883758545e-01 7.968277931213378906e-01 7 | -6.248394250869750977e-01 -2.653158009052276611e-01 8 | 1.813528500497341156e-02 -9.300193786621093750e-01 9 | 10 | 4.050752222537994385e-01 11 | 5.949248075485229492e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/32.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 8.338066935539245605e-02 -5.063601136207580566e-01 3 | -4.798352345824241638e-02 5.418967604637145996e-01 4 | 8.243876099586486816e-01 -1.303137987852096558e-01 5 | 6 | -9.235171079635620117e-01 3.365896940231323242e-01 7 | -1.516855657100677490e-01 -9.772838354110717773e-01 8 | 4.120269417762756348e-01 1.380964964628219604e-01 9 | 10 | 2.143374085426330566e-02 11 | 9.785662293434143066e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/33.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 2.158124893903732300e-01 -4.466958045959472656e-01 3 | -4.630002677440643311e-01 1.801673322916030884e-01 4 | 4.861976206302642822e-01 -3.014578521251678467e-01 5 | 6 | 5.935215950012207031e-01 7.075178623199462891e-01 7 | 6.147270798683166504e-01 -5.240126252174377441e-01 8 | 5.402814149856567383e-01 9.455994367599487305e-01 9 | 10 | 1.837634146213531494e-01 11 | 8.162365555763244629e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/34.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -5.015438199043273926e-01 -6.343482732772827148e-01 3 | -7.550081610679626465e-01 6.315669417381286621e-01 4 | 4.962920546531677246e-01 1.447931081056594849e-01 5 | 6 | 5.353795886039733887e-01 -9.540669620037078857e-03 7 | -6.919272243976593018e-02 -3.036745190620422363e-01 8 | 5.201215147972106934e-01 -4.202593266963958740e-01 9 | 10 | 8.297686576843261719e-01 11 | 1.702313423156738281e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/35.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -2.893448173999786377e-01 -8.306431770324707031e-01 3 | 1.054689049720764160e+00 3.423809111118316650e-01 4 | 7.500016689300537109e-01 -1.434027254581451416e-01 5 | 6 | 2.330315113067626953e-01 -2.080211490392684937e-01 7 | -3.446231363341212273e-03 -6.605318188667297363e-01 8 | 9.566347599029541016e-01 -9.110050201416015625e-01 9 | 10 | 8.340124487876892090e-01 11 | 1.659875810146331787e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/36.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 8.458074331283569336e-01 -9.269016981124877930e-01 3 | 3.788162469863891602e-01 5.190823674201965332e-01 4 | 8.204903602600097656e-01 8.688170313835144043e-01 5 | 6 | 4.960506781935691833e-02 -3.720591366291046143e-01 7 | -1.466070115566253662e-01 -4.476743638515472412e-01 8 | -5.049805045127868652e-01 2.093260735273361206e-01 9 | 10 | 9.114645123481750488e-01 11 | 8.853547275066375732e-02 12 | -------------------------------------------------------------------------------- /templates/ifs/37.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 6.454756855964660645e-01 -6.356917619705200195e-01 3 | -5.536838173866271973e-01 -5.013210773468017578e-01 4 | 5.423402190208435059e-01 -3.171318769454956055e-01 5 | 6 | -2.802968025207519531e-01 7.437097430229187012e-01 7 | 2.586317658424377441e-01 2.651444077491760254e-01 8 | 1.914121359586715698e-01 9.948543310165405273e-01 9 | 10 | 7.169837355613708496e-01 11 | 2.830162346363067627e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/38.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 2.741230726242065430e-01 -3.163306415081024170e-01 3 | 7.885450720787048340e-01 -1.361192762851715088e-01 4 | 9.034081697463989258e-01 -6.189980506896972656e-01 5 | 6 | 6.144201159477233887e-01 -5.962828993797302246e-01 7 | 6.576197743415832520e-01 5.446425676345825195e-01 8 | -7.432201504707336426e-01 4.534547924995422363e-01 9 | 10 | 2.259333431720733643e-01 11 | 7.740666270256042480e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/4.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 2.741230726242065430e-01 -3.163306415081024170e-01 3 | 7.885450720787048340e-01 7.409875839948654175e-02 4 | -2.175740599632263184e-01 -6.189980506896972656e-01 5 | 6 | 6.144201159477233887e-01 -5.962828993797302246e-01 7 | 6.576197743415832520e-01 5.446425676345825195e-01 8 | -5.330021381378173828e-01 4.534547924995422363e-01 9 | 10 | 2.706951797008514404e-01 11 | 7.293047904968261719e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/41.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -6.636197566986083984e-01 -3.881087899208068848e-01 3 | -1.562887579202651978e-01 1.853957399725914001e-02 4 | -3.579021990299224854e-02 9.280113577842712402e-01 5 | 6 | -5.317370295524597168e-01 -7.562537789344787598e-01 7 | -7.294685840606689453e-01 5.415504574775695801e-01 8 | 3.960112854838371277e-02 -6.158697009086608887e-01 9 | 10 | 7.994891703128814697e-02 11 | 9.200510978698730469e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/42.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 3.825509548187255859e-01 -1.176550984382629395e+00 3 | 7.524597048759460449e-01 4.222153127193450928e-02 4 | 3.579848408699035645e-01 -2.421001642942428589e-01 5 | 6 | 6.603820621967315674e-02 -2.162567377090454102e-01 7 | -4.590546488761901855e-01 9.708037227392196655e-02 8 | 4.727409482002258301e-01 8.361865580081939697e-02 9 | 10 | 9.066070318222045898e-01 11 | 9.339295327663421631e-02 12 | -------------------------------------------------------------------------------- /templates/ifs/43.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 8.945363163948059082e-01 -1.478632390499114990e-01 3 | 1.059448570013046265e-01 9.907785654067993164e-01 4 | -4.352406263351440430e-01 5.188815593719482422e-01 5 | 6 | -1.528234779834747314e-01 4.149338901042938232e-01 7 | 1.083617061376571655e-01 3.805566430091857910e-01 8 | 1.745147630572319031e-02 -7.513859272003173828e-01 9 | 10 | 8.973996043205261230e-01 11 | 1.026003658771514893e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/46.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 7.253707647323608398e-01 2.917317748069763184e-01 3 | -2.331078350543975830e-01 7.551455497741699219e-01 4 | -4.960305392742156982e-01 3.294521868228912354e-01 5 | 6 | -6.067799329757690430e-01 1.717406511306762695e-01 7 | -7.768964767456054688e-02 -4.946635365486145020e-01 8 | 5.918506979942321777e-01 -2.538816034793853760e-01 9 | 10 | 6.626408100128173828e-01 11 | 3.373592197895050049e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/47.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 5.585744976997375488e-01 -5.377674698829650879e-01 3 | 5.282308459281921387e-01 8.868879675865173340e-01 4 | 5.596962571144104004e-01 -8.571526408195495605e-01 5 | 6 | 1.713189668953418732e-02 3.981460034847259521e-01 7 | -3.737271726131439209e-01 -2.002073228359222412e-01 8 | 5.350522398948669434e-01 5.156998634338378906e-01 9 | 10 | 8.428158760070800781e-01 11 | 1.571841537952423096e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/9.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -5.591261386871337891e-01 -3.457210063934326172e-01 3 | -1.211515665054321289e-01 6.363531947135925293e-01 4 | -5.734653472900390625e-01 -8.536418080329895020e-01 5 | 6 | 4.343120157718658447e-01 4.656800925731658936e-01 7 | -5.487551093101501465e-01 6.472016572952270508e-01 8 | -6.587966680526733398e-01 1.040618680417537689e-02 9 | 10 | 4.256434142589569092e-01 11 | 5.743566155433654785e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/21.csv: -------------------------------------------------------------------------------- 1 | 2 2 | 3.110893964767456055e-01 -2.272337116301059723e-02 3 | -3.110869228839874268e-01 -5.661085844039916992e-01 4 | -6.014444231986999512e-01 -1.248080749064683914e-02 5 | 6 | -8.480200767517089844e-01 -2.699431404471397400e-02 7 | 1.123276054859161377e-01 -8.477082848548889160e-01 8 | 2.366873323917388916e-01 -6.017077565193176270e-01 9 | 10 | 2.023890465497970581e-01 11 | 7.976109385490417480e-01 12 | -------------------------------------------------------------------------------- /templates/ifs/26.csv: -------------------------------------------------------------------------------- 1 | 2 2 | -5.172688961029052734e-01 8.086049556732177734e-01 3 | -7.031580805778503418e-01 -6.020253896713256836e-01 4 | -8.855181932449340820e-01 -1.371643394231796265e-01 5 | 6 | -2.202740758657455444e-01 -2.349525690078735352e-01 7 | -2.399891316890716553e-01 -6.259116530418395996e-01 8 | -6.352252364158630371e-01 5.693696141242980957e-01 9 | 10 | 9.152486324310302734e-01 11 | 8.475133776664733887e-02 12 | -------------------------------------------------------------------------------- /templates/ifs/triangle.csv: -------------------------------------------------------------------------------- 1 | 3 2 | 5.000000000000000000e-01 0.000000000000000000e+00 3 | 0.000000000000000000e+00 5.000000000000000000e-01 4 | 0.000000000000000000e+00 0.000000000000000000e+00 5 | 6 | 5.000000000000000000e-01 0.000000000000000000e+00 7 | 0.000000000000000000e+00 5.000000000000000000e-01 8 | 5.000000000000000000e-01 0.000000000000000000e+00 9 | 10 | 5.000000000000000000e-01 0.000000000000000000e+00 11 | 0.000000000000000000e+00 5.000000000000000000e-01 12 | 2.500000000000000000e-01 4.330126941204071045e-01 13 | 14 | 3.333333432674407959e-01 15 | 3.333333432674407959e-01 16 | 3.333333432674407959e-01 17 | -------------------------------------------------------------------------------- /templates/ifs/15.csv: -------------------------------------------------------------------------------- 1 | 3 2 | -9.219264984130859375e-01 4.759861901402473450e-02 3 | -6.973230838775634766e-02 -9.515737891197204590e-01 4 | -2.283178716897964478e-01 9.311082214117050171e-02 5 | 6 | -2.488958090543746948e-02 3.134811520576477051e-01 7 | -3.150718808174133301e-01 -1.322883665561676025e-01 8 | 5.473212599754333496e-01 2.837203741073608398e-01 9 | 10 | -1.016374826431274414e-01 -2.493436262011528015e-02 11 | 6.396992802619934082e-01 5.594250559806823730e-01 12 | -5.290608853101730347e-02 9.540239721536636353e-02 13 | 14 | 8.603224158287048340e-01 15 | 9.971150010824203491e-02 16 | 3.996606543660163879e-02 17 | -------------------------------------------------------------------------------- /templates/ifs/16.csv: -------------------------------------------------------------------------------- 1 | 3 2 | 6.152142211794853210e-02 -3.120713867247104645e-02 3 | 2.763444557785987854e-02 4.348141327500343323e-02 4 | -4.551262259483337402e-01 -2.507606148719787598e-01 5 | 6 | 7.382270097732543945e-01 -6.723585724830627441e-02 7 | -3.229201957583427429e-02 -7.491358518600463867e-01 8 | -8.196532130241394043e-01 6.297577023506164551e-01 9 | 10 | -4.994557499885559082e-01 3.033996224403381348e-01 11 | 5.492821335792541504e-01 4.994727671146392822e-01 12 | 3.981067240238189697e-02 -8.166596293449401855e-01 13 | 14 | 3.628664184361696243e-03 15 | 5.695227384567260742e-01 16 | 4.268485903739929199e-01 17 | -------------------------------------------------------------------------------- /templates/ifs/17.csv: -------------------------------------------------------------------------------- 1 | 3 2 | 6.952523440122604370e-02 -7.697524428367614746e-01 3 | -9.206501245498657227e-01 -4.856527596712112427e-02 4 | 8.788207769393920898e-01 9.718652814626693726e-02 5 | 6 | 5.955525860190391541e-02 -3.856447637081146240e-01 7 | -2.715651988983154297e-01 -1.478001475334167480e-01 8 | 1.483071595430374146e-01 -7.141612172126770020e-01 9 | 10 | 2.375828176736831665e-01 1.795817613601684570e-01 11 | -1.710347831249237061e-01 5.843998193740844727e-01 12 | 3.216251730918884277e-01 -8.557478785514831543e-01 13 | 14 | 7.155286073684692383e-01 15 | 1.140847429633140564e-01 16 | 1.703866273164749146e-01 17 | -------------------------------------------------------------------------------- /templates/ifs/2.csv: -------------------------------------------------------------------------------- 1 | 3 2 | 5.384387075901031494e-02 3.377970457077026367e-01 3 | -1.131216734647750854e-01 8.644303083419799805e-01 4 | 7.716263532638549805e-01 -3.258408010005950928e-01 5 | 6 | 5.593141913414001465e-01 -1.077335119247436523e+00 7 | 7.438651919364929199e-01 1.537556499242782593e-01 8 | -8.736324310302734375e-01 -8.798886537551879883e-01 9 | 10 | 1.886319518089294434e-01 -3.019415140151977539e-01 11 | 1.705350577831268311e-01 -2.871949970722198486e-01 12 | -7.246819734573364258e-01 -1.123465374112129211e-01 13 | 14 | 8.694495260715484619e-02 15 | 9.103032350540161133e-01 16 | 2.751807449385523796e-03 17 | -------------------------------------------------------------------------------- /templates/ifs/44.csv: -------------------------------------------------------------------------------- 1 | 3 2 | -2.860956490039825439e-01 -2.830793857574462891e-01 3 | -7.660338282585144043e-02 2.400231808423995972e-01 4 | -5.412490963935852051e-01 6.826602220535278320e-01 5 | 6 | -4.198571145534515381e-01 -1.234632432460784912e-01 7 | -6.520895659923553467e-02 -4.058596491813659668e-01 8 | -3.668508529663085938e-01 -4.271433949470520020e-01 9 | 10 | -8.487834781408309937e-02 6.702694892883300781e-01 11 | 9.861522912979125977e-01 8.934280276298522949e-02 12 | 4.484777748584747314e-01 5.116838812828063965e-01 13 | 14 | 9.807513654232025146e-02 15 | 1.762250065803527832e-01 16 | 7.256998419761657715e-01 17 | -------------------------------------------------------------------------------- /templates/ifs/6.csv: -------------------------------------------------------------------------------- 1 | 3 2 | -2.989332973957061768e-01 2.133808583021163940e-01 3 | 6.792549788951873779e-02 2.236392945051193237e-01 4 | 2.176154851913452148e-01 -1.002409146167337894e-03 5 | 6 | -3.311097621917724609e-01 8.611428141593933105e-01 7 | -8.193104267120361328e-01 -4.055876731872558594e-01 8 | -4.770664572715759277e-01 -6.710825115442276001e-02 9 | 10 | -1.156655102968215942e-01 -1.925359070301055908e-01 11 | 1.842515617609024048e-01 -2.583538591861724854e-01 12 | 1.320720314979553223e-01 7.552862912416458130e-02 13 | 14 | 8.245691657066345215e-02 15 | 8.512938618659973145e-01 16 | 6.624923646450042725e-02 17 | -------------------------------------------------------------------------------- /templates/ifs/7.csv: -------------------------------------------------------------------------------- 1 | 3 2 | -2.989332973957061768e-01 2.133808583021163940e-01 3 | 6.792549788951873779e-02 2.236392945051193237e-01 4 | 2.176154851913452148e-01 7.843559384346008301e-01 5 | 6 | -3.311097621917724609e-01 8.611428141593933105e-01 7 | -8.193104267120361328e-01 -4.055876731872558594e-01 8 | -4.770664572715759277e-01 -6.710825115442276001e-02 9 | 10 | -1.156655102968215942e-01 -1.925359070301055908e-01 11 | 1.842515617609024048e-01 -2.583538591861724854e-01 12 | 1.320720314979553223e-01 7.552862912416458130e-02 13 | 14 | 8.245691657066345215e-02 15 | 8.512938618659973145e-01 16 | 6.624923646450042725e-02 17 | -------------------------------------------------------------------------------- /templates/ifs/8.csv: -------------------------------------------------------------------------------- 1 | 3 2 | -2.989332973957061768e-01 -2.000038474798202515e-01 3 | 6.792549788951873779e-02 2.236392945051193237e-01 4 | 2.176154851913452148e-01 -1.495669633150100708e-01 5 | 6 | -3.311097621917724609e-01 8.611428141593933105e-01 7 | -8.193104267120361328e-01 -4.055876731872558594e-01 8 | -4.770664572715759277e-01 -6.710825115442276001e-02 9 | 10 | -1.156655102968215942e-01 -1.925359070301055908e-01 11 | 1.842515617609024048e-01 -2.583538591861724854e-01 12 | 1.320720314979553223e-01 7.552862912416458130e-02 13 | 14 | 5.557635426521301270e-02 15 | 8.762335777282714844e-01 16 | 6.819009035825729370e-02 17 | -------------------------------------------------------------------------------- /templates/ifs/39.csv: -------------------------------------------------------------------------------- 1 | 3 2 | -2.113612890243530273e-01 5.233665704727172852e-01 3 | 3.100470900535583496e-01 -4.326239824295043945e-01 4 | -3.372985124588012695e-01 -4.971608519554138184e-01 5 | 6 | -6.163770556449890137e-01 8.454950451850891113e-01 7 | -6.166773438453674316e-01 -6.086855530738830566e-01 8 | -8.565683364868164062e-01 -6.556413173675537109e-01 9 | 10 | -2.808740139007568359e-01 -2.504510283470153809e-01 11 | 1.401106268167495728e-01 -4.475929774343967438e-03 12 | -5.548907518386840820e-01 9.291697740554809570e-01 13 | 14 | 7.056344300508499146e-02 15 | 8.932244777679443359e-01 16 | 3.621209040284156799e-02 17 | -------------------------------------------------------------------------------- /templates/ifs/fern.csv: -------------------------------------------------------------------------------- 1 | 4 2 | 0.000000000000000000e+00 0.000000000000000000e+00 3 | 0.000000000000000000e+00 1.599999964237213135e-01 4 | 0.000000000000000000e+00 0.000000000000000000e+00 5 | 6 | 8.500000238418579102e-01 -3.999999910593032837e-02 7 | 3.999999910593032837e-02 8.500000238418579102e-01 8 | 0.000000000000000000e+00 1.600000023841857910e+00 9 | 10 | 2.000000029802322388e-01 2.300000041723251343e-01 11 | -2.599999904632568359e-01 2.199999988079071045e-01 12 | 0.000000000000000000e+00 1.600000023841857910e+00 13 | 14 | -1.500000059604644775e-01 2.599999904632568359e-01 15 | 2.800000011920928955e-01 2.399999946355819702e-01 16 | 0.000000000000000000e+00 4.399999976158142090e-01 17 | 18 | 9.999999776482582092e-03 19 | 8.500000238418579102e-01 20 | 7.000000029802322388e-02 21 | 7.000000029802322388e-02 22 | -------------------------------------------------------------------------------- /templates/ifs/45.csv: -------------------------------------------------------------------------------- 1 | 4 2 | 1.640513241291046143e-01 4.572197049856185913e-02 3 | -2.267527161166071892e-04 -1.854664534330368042e-01 4 | -5.109562277793884277e-01 -6.485455632209777832e-01 5 | 6 | -5.311243534088134766e-01 3.194562792778015137e-01 7 | 2.807791233062744141e-01 -8.791941404342651367e-02 8 | -6.832149028778076172e-01 3.577628359198570251e-02 9 | 10 | -1.309022009372711182e-01 -2.052656933665275574e-02 11 | 5.558746308088302612e-02 3.012146651744842529e-01 12 | -3.846027851104736328e-01 9.125012904405593872e-02 13 | 14 | -1.434179544448852539e-01 1.037526726722717285e+00 15 | 7.885982394218444824e-01 1.422911882400512695e-01 16 | 4.211580455303192139e-01 6.820874214172363281e-01 17 | 18 | 3.200624138116836548e-02 19 | 4.524923488497734070e-02 20 | 4.029095545411109924e-02 21 | 8.824535608291625977e-01 22 | -------------------------------------------------------------------------------- /templates/ifs/40.csv: -------------------------------------------------------------------------------- 1 | 4 2 | -6.564421206712722778e-02 -2.425039410591125488e-01 3 | 5.340178608894348145e-01 7.813308238983154297e-01 4 | 4.841049611568450928e-01 3.391837775707244873e-01 5 | 6 | 2.991712093353271484e-01 2.274302840232849121e-01 7 | 3.149691969156265259e-02 -1.023555770516395569e-01 8 | -1.088793277740478516e-01 -8.039344102144241333e-02 9 | 10 | -6.464101374149322510e-02 -2.130205743014812469e-02 11 | -4.802564904093742371e-02 -8.020415902137756348e-02 12 | -8.624221086502075195e-01 -2.593745589256286621e-01 13 | 14 | 9.861186146736145020e-01 2.913230657577514648e-01 15 | -1.964873075485229492e-01 7.760912179946899414e-01 16 | -5.655853748321533203e-01 -6.632540822029113770e-01 17 | 18 | 8.296396583318710327e-02 19 | 4.008114337921142578e-02 20 | 4.414294380694627762e-03 21 | 8.725405931472778320e-01 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 davidsvy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/render.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import os 3 | import matplotlib.pyplot as plt 4 | 5 | from src.io import img_subdir, ifs_subdir, save_ifs 6 | 7 | 8 | cmap_dict = { 9 | cmap[0]: cmap for cmap in ['inferno', 'plasma', 'magma', 'cividis', 'viridis'] 10 | } 11 | 12 | 13 | def render_fractal(canvas, ifs, args): 14 | """Renders or/and saves the constructed image. 15 | 16 | Args: 17 | canvas (np.array [res, res] or [res, res, 3]): The generated image. 18 | ifs (tuple of (np.array, np.array, np.array)): w [n, 2, 2], 19 | b [n, 1, 2], p [n]. 20 | args (argparse.Namespace): Arguments for the fractal construction. See run.py 21 | for more details. 22 | """ 23 | img_dir = os.path.join(args.dir, img_subdir) 24 | ifs_dir = os.path.join(args.dir, ifs_subdir) 25 | 26 | if args.save is not None: 27 | os.makedirs(img_dir, exist_ok=True) 28 | os.makedirs(ifs_dir, exist_ok=True) 29 | 30 | if args.save == True: 31 | file_name = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S") 32 | else: 33 | file_name = args.save 34 | img_path = os.path.join(img_dir, f'{file_name}.png') 35 | ifs_path = os.path.join(ifs_dir, f'{file_name}.csv') 36 | 37 | plt.imsave(fname=img_path, arr=canvas, cmap=args.cmap) 38 | save_ifs(ifs=ifs, path=ifs_path) 39 | 40 | if args.plot: 41 | plt.figure(figsize=(17, 17)) 42 | plt.imshow(canvas, cmap=args.cmap) 43 | plt.axis('off') 44 | plt.show() 45 | -------------------------------------------------------------------------------- /src/io.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import numpy as np 3 | import os 4 | import pathlib 5 | 6 | img_subdir = 'images' 7 | ifs_subdir = 'ifs' 8 | 9 | 10 | def save_ifs(ifs, path): 11 | """Saves a given IFS into a csv file. 12 | 13 | Args: 14 | ifs (tuple of (np.array, np.array, np.array)): w [n, 2, 2], 15 | b [n, 1, 2], p [n]. 16 | path (str): Where to store the IFS. 17 | """ 18 | w, b, p = ifs 19 | w_b = np.concatenate([w, b], axis=1) 20 | 21 | with open(path, 'w') as file: 22 | file.truncate() 23 | file.write(f'{w_b.shape[0]}\n') 24 | 25 | for slice in w_b: 26 | np.savetxt(file, slice) 27 | file.write('\n') 28 | 29 | np.savetxt(file, p) 30 | 31 | 32 | def read_ifs(path): 33 | """Reads an IFS from a given csv file. 34 | 35 | Args: 36 | path (str): Path to the csv file. 37 | 38 | Returns: 39 | np.array [n, 2, 2]: Matrix w. 40 | np.array [n, 1, 2]: Bias b. 41 | np.array [n]: Probability distribution p. 42 | """ 43 | assert os.path.isfile(path), f'"{path}" is not a valid IFS.' 44 | 45 | with open(path, 'r') as file: 46 | n_ifs = int(file.readline()) 47 | 48 | w_b, p = [], [] 49 | for step in range(1, 4 * n_ifs + 1): 50 | row = file.readline() 51 | if step % 4: 52 | w_b.append(row) 53 | 54 | for step in range(n_ifs): 55 | prob = float(file.readline()) 56 | assert prob > 0, 'Probabilities must be positive numbers.' 57 | p.append(prob) 58 | 59 | w_b = np.array([[float(x) for x in row.split()] for row in w_b]) 60 | w_b = w_b.reshape([n_ifs, 3, 2]) 61 | w, b = np.split(w_b, [2], axis=1) 62 | 63 | p = np.array(p) 64 | p /= p.sum() 65 | 66 | return w, b, p 67 | 68 | 69 | def most_recent_file(args): 70 | """Finds the most recently modified IFS file. 71 | 72 | Args: 73 | args (argparse.Namespace): Arguments for the fractal construction. See run.py 74 | for more details. 75 | 76 | Returns: 77 | str: Path to the most recently modified IFS file. 78 | """ 79 | csv_dir = os.path.join(args.dir, ifs_subdir) 80 | all_files = pathlib.Path(csv_dir).rglob('*.csv') 81 | assert all_files, f'Directory "{csv_dir}" does not contain any csv files.' 82 | most_recent = max(all_files, key=os.path.getmtime) 83 | 84 | return most_recent 85 | 86 | 87 | def read_image(path): 88 | """Reads a given image. 89 | 90 | Args: 91 | path (str): Path to the image. 92 | 93 | Returns: 94 | np.array: Image as NumPy array. 95 | """ 96 | assert os.path.isfile(path), f'"{path}" is not a valid image.' 97 | image = plt.imread(path) 98 | assert len(image.shape) == 3 and image.shape[2] >= 3, \ 99 | 'Image must have at least 3 channels.' 100 | if image.shape[2] > 3: 101 | image = image[..., :3] 102 | 103 | return image 104 | -------------------------------------------------------------------------------- /run.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import os 3 | 4 | from src.chaos_game import build_fractal 5 | from src.io import most_recent_file 6 | from src.render import cmap_dict, render_fractal 7 | 8 | 9 | def parse_args(): 10 | parser = argparse.ArgumentParser() 11 | 12 | parser.add_argument( 13 | '--resolution', '-r', type=int, default=2 ** 10, 14 | help='Resolution of the created image. The image is square, so provide only one number.') 15 | parser.add_argument( 16 | '--batch_size', '-b', type=int, default=128, 17 | help='Number of points calculated at each iteration. ' 18 | 'For fractal flame, should be <= 4 for better visuals.') 19 | parser.add_argument( 20 | '--n_iter', '-i', type=int, default=int(5e4), 21 | help='Number of iterations for the chaos game algorithm.') 22 | parser.add_argument( 23 | '--n_ignore', '-ni', type=int, default=int(2e2), 24 | help='Number of initial iterations that will not be rendered.') 25 | parser.add_argument( 26 | '--cmap', '-cm', type=str, default='i', choices=list(cmap_dict.keys()), 27 | help='Matplotlib cmap for plotting/saving the image. Ignored if -f or -c is given.') 28 | parser.add_argument( 29 | '--plot', '-p', action='store_true', 30 | help='If given, the image will be rendered with plt.imshow.') 31 | parser.add_argument( 32 | '--save', '-s', nargs='?', const=True, 33 | help='Usage: If not given, the image will not be saved.' 34 | 'If run as "-s", the image & IFS will be stored with the current timestamp as names.' 35 | 'If run as "-s ", the image will be stored as .png and the IFS as .csv.') 36 | parser.add_argument( 37 | '--load', '-l', type=str, default='', 38 | help='Path to stored csv IFS file. Usage: -l .') 39 | parser.add_argument( 40 | '--mutate', '-m', type=str, default='', 41 | help='Path to stored csv IFS file that will be loaded & mutated. Usage: -m .') 42 | parser.add_argument( 43 | '--no_tqdm', '-nt', action='store_true', 44 | help='If given, the tqdm progress bar will not be used.') 45 | parser.add_argument( 46 | '--dir', '-d', type=str, default='creations', 47 | help='Directory where the image & csv file will be stored.') 48 | parser.add_argument( 49 | '--color_steal', '-c', type=str, default='', 50 | help='Path to an image that will be used for color stealing. Usage: -c .') 51 | parser.add_argument( 52 | '--flame', '-f', action='store_true', 53 | help='If given, the Fractal Flame Algorithm will be used.') 54 | parser.add_argument( 55 | '--gamma', '-g', type=float, default=20., 56 | help='Gamma parameter for the fractal frame algorithm.') 57 | parser.add_argument( 58 | '--sup', '-su', type=int, default=3, 59 | help='Supersampling ratio for the fractal flame algorithm.') 60 | 61 | args = parser.parse_args() 62 | args.cmap = cmap_dict[args.cmap] 63 | 64 | assert args.save or args.plot, 'Provide either -s or -p to run.' 65 | assert not (args.color_steal and args.flame), \ 66 | 'Cannot use both color stealing and fractal flame. Pick one.' 67 | 68 | if args.color_steal: 69 | assert os.path.isfile(args.color_steal), \ 70 | f'"{args.color_steal}" is not a valid image.' 71 | 72 | if args.load == 'r': 73 | args.load = most_recent_file(args) 74 | if args.mutate == 'r': 75 | args.mutate = most_recent_file(args) 76 | 77 | assert args.gamma > 0, 'Gamma must be positive.' 78 | assert args.sup >= 1, 'Sup must be at least one.' 79 | 80 | assert args.n_iter > args.n_ignore, 'Provide n_iter >> n_ignore' 81 | 82 | return args 83 | 84 | 85 | def main(): 86 | args = parse_args() 87 | canvas, ifs = build_fractal(args) 88 | render_fractal(canvas=canvas, ifs=ifs, args=args) 89 | 90 | 91 | if __name__ == '__main__': 92 | main() 93 | -------------------------------------------------------------------------------- /src/ifs.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | from src.io import read_ifs 4 | 5 | 6 | def mutate1(ifs): 7 | """Mutates an IFS by adding random noise to a subset of its params. 8 | 9 | Args: 10 | ifs (tuple of (np.array, np.array, np.array)): w [n, 2, 2], 11 | b [n, 1, 2], p [n]. 12 | 13 | Returns: 14 | np.array [n, 2, 2]: Matrix w. 15 | np.array [n, 1, 2]: Bias b. 16 | """ 17 | mut_prob, noise_std = 0.15, 0.1 18 | w_b = np.concatenate(ifs[:2], axis=1) 19 | 20 | mut_mask = np.random.binomial(n=1, p=mut_prob, size=w_b.shape) 21 | if mut_mask.max() == 0: 22 | idx = np.random.choice(np.size(w_b)) 23 | mut_mask = np.zeros(shape=np.size(w_b)) 24 | mut_mask[idx] = 1 25 | mut_mask = mut_mask.reshape(w_b.shape) 26 | 27 | noise = np.random.normal(scale=noise_std) 28 | noise = np.multiply(noise, mut_mask) 29 | w, b = np.split(w_b + noise, [2], axis=1) 30 | 31 | return w, b 32 | 33 | 34 | def mutate2(ifs): 35 | """Mutates an IFS by changing a single of its parameters. 36 | 37 | Args: 38 | ifs (tuple of (np.array, np.array, np.array)): w [n, 2, 2], 39 | b [n, 1, 2], p [n]. 40 | 41 | Returns: 42 | np.array [n, 2, 2]: Matrix w. 43 | np.array [n, 1, 2]: Bias b. 44 | """ 45 | w_b = np.concatenate(ifs[:2], axis=1) 46 | w_b_shape = w_b.shape 47 | 48 | idx = np.random.choice(np.size(w_b)) 49 | w_b = w_b.flatten() 50 | w_b[idx] = np.random.uniform(low=-1, high=1) 51 | w_b = w_b.reshape(w_b_shape) 52 | w, b = np.split(w_b, [2], axis=1) 53 | 54 | return w, b 55 | 56 | 57 | def mutate_ifs(ifs): 58 | """Mutates an IFS by either adding noise or changing a single param. 59 | 60 | Args: 61 | ifs (tuple of (np.array, np.array, np.array)): w [n, 2, 2], 62 | b [n, 1, 2], p [n]. 63 | 64 | Returns: 65 | np.array [n, 2, 2]: Matrix w. 66 | np.array [n, 1, 2]: Bias b. 67 | np.array [n]: Probability distribution p. 68 | """ 69 | all_mutations = [mutate1, mutate2] 70 | mutate_fn = np.random.choice(all_mutations) 71 | w, b = mutate_fn(ifs) 72 | 73 | p = np.abs([np.linalg.det(x) for x in w]) 74 | p /= p.sum() 75 | 76 | return w, b, p 77 | 78 | 79 | def sample_ifs(n_ifs=None): 80 | """Constructs a random IFS. 81 | 82 | Simply sampling random numbers often leads to degenerate solutions. 83 | Threfore, the IFS is constructed using heuristics proposed in: 84 | https://arxiv.org/pdf/2110.03091.pdf 85 | 86 | Args: 87 | n_ifs (int, None): Number of functions in the IFS. If None, the 88 | number is randomly sampled. 89 | 90 | Returns: 91 | np.array [n, 2, 2]: Matrix w. 92 | np.array [n, 1, 2]: Bias b. 93 | np.array [n]: Probability distribution p. 94 | """ 95 | if not n_ifs: 96 | n_ifs = np.random.randint(low=2, high=9) 97 | 98 | theta_phi = np.random.uniform(low=0, high=np.pi, size=[2, n_ifs]) 99 | cos_theta, cos_phi = np.cos(theta_phi) 100 | sin_theta, sin_phi = np.sin(theta_phi) 101 | r_theta = np.array( 102 | [[cos_theta, -sin_theta], [sin_theta, cos_theta]]).transpose([2, 0, 1]) 103 | r_phi = np.array( 104 | [[cos_phi, -sin_phi], [sin_phi, cos_phi]]).transpose([2, 0, 1]) 105 | 106 | d = np.random.choice([-1., 1.], size=[n_ifs, 2]) 107 | d = np.stack([np.diag(x) for x in d]) 108 | 109 | sigma = np.sort(np.random.uniform(size=[n_ifs, 2]))[:, ::-1] 110 | alpha = sigma[:, 0].sum() + 2 * sigma[:, 1].sum() 111 | norm = np.random.uniform(low=0.5 * (5 + n_ifs), high=0.5 * (6 + n_ifs)) 112 | sigma = sigma / alpha * norm 113 | sigma = np.stack([np.diag(x) for x in sigma]) 114 | 115 | w = np.einsum( 116 | 'n a b, n b c, n c d, n d e -> n a e', r_theta, sigma, r_phi, d) 117 | w = w.transpose([0, 2, 1]) 118 | 119 | b = np.random.uniform(low=-1, high=1, size=[n_ifs, 1, 2]) 120 | p = np.abs([np.linalg.det(x) for x in w]) 121 | p /= p.sum() 122 | 123 | w, b, p = map(lambda x: x.astype(np.float32), [w, b, p]) 124 | 125 | return w, b, p 126 | 127 | 128 | def build_ifs(args): 129 | """Constructs an IFS based on args. 130 | 131 | Args: 132 | args (argparse.Namespace): Arguments for the fractal construction. See run.py 133 | for more details. 134 | 135 | Returns: 136 | Returns: 137 | np.array [n, 2, 2]: Matrix w. 138 | np.array [n, 1, 2]: Bias b. 139 | np.array [n]: Probability distribution p. 140 | """ 141 | if args.load: 142 | w, b, p = read_ifs(args.load) 143 | 144 | elif args.mutate: 145 | ifs = read_ifs(args.mutate) 146 | w, b, p = mutate_ifs(ifs) 147 | 148 | else: 149 | w, b, p = sample_ifs() 150 | 151 | w, b, p = map(lambda x: x.astype(np.float32), [w, b, p]) 152 | 153 | return w, b, p 154 | -------------------------------------------------------------------------------- /src/chaos_game.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import skimage.measure 3 | import tqdm 4 | 5 | from src.ifs import build_ifs, sample_ifs 6 | from src.io import read_image 7 | 8 | 9 | def loop_wrapper(x, args): 10 | """Wraps an iterator inside tqdm if args.no_tqdm == True. 11 | """ 12 | return x if args.no_tqdm else tqdm.tqdm(x) 13 | 14 | 15 | def find_min_max(point_list): 16 | """Finds min & max inside a list of arrays. 17 | 18 | Args: 19 | point_list (list of np.array of float): Each array has dimensions 20 | [n, d] where n is variable and d is shared by all arrays. 21 | 22 | Returns: 23 | np.array of float [d]: Min vector. 24 | np.array of float [d]: Max vector. 25 | """ 26 | min_, max_ = point_list[0][0] 27 | 28 | for batch in point_list: 29 | min_ = np.minimum(min_, batch.min(axis=0)) 30 | max_ = np.maximum(max_, batch.max(axis=0)) 31 | min_, max_ = min_[None, ...], max_[None, ...] 32 | 33 | return min_, max_ 34 | 35 | 36 | def binary_fractal(args): 37 | """Constructs a binary fractal using chaos game (ie random iterations). 38 | 39 | Args: 40 | args (argparse.Namespace): Arguments for the fractal construction. See run.py 41 | for more details. 42 | 43 | Returns: 44 | np.array of bool [args.resolution, args.resolution]: Binary array where 45 | points that belong to the fractal are True. 46 | tuple (np.array, np.array, np.array): Parameters of the IFS that constructed 47 | the fractal: w [n, 2, 2], b [n, 1, 2], p [n]. 48 | """ 49 | w, b, p = build_ifs(args) 50 | coord_buffer = [] 51 | batch = np.random.uniform(size=[args.batch_size, 2]).astype(np.float32) 52 | 53 | # To speed things up, at each iteration, a batch of coordinates (instead of a single 54 | # point) is calculated. The batches are stored inside a buffer and after the final 55 | # iteration, the coordinates are normalized to [0, 1]x[0, 1] and plotted on a grid. 56 | 57 | for step in loop_wrapper(range(args.n_iter), args=args): 58 | ifs_idxs = np.random.choice(w.shape[0], size=args.batch_size, p=p) 59 | next_batch = [] 60 | 61 | for ifs_idx in range(w.shape[0]): 62 | next_batch.append( 63 | np.matmul(batch[ifs_idxs == ifs_idx], w[ifs_idx]) + b[ifs_idx]) 64 | 65 | batch = np.concatenate(next_batch, axis=0) 66 | 67 | # The initial iterations are ignored as the coordinates have not converged yet. 68 | if step > args.n_ignore: 69 | coord_buffer.append(batch) 70 | 71 | canvas = np.full( 72 | [args.resolution, args.resolution], fill_value=False, dtype=bool) 73 | 74 | min_, max_ = find_min_max(coord_buffer) 75 | 76 | for batch in coord_buffer: 77 | batch = (batch - min_) / (max_ - min_) 78 | batch = np.clip( 79 | (batch * args.resolution).astype(int), a_min=0, a_max=args.resolution - 1) 80 | 81 | canvas[batch[:, 0], batch[:, 1]] = True 82 | 83 | canvas = np.rot90(canvas) 84 | 85 | return canvas, (w, b, p) 86 | 87 | 88 | def color_steal(args): 89 | """Constructs a colorful fractal using the Color Stealing Algorithm: 90 | 91 | https://maths-people.anu.edu.au/~barnsley/pdfs/fractal_tops.pdf 92 | 93 | Args: 94 | args (argparse.Namespace): Arguments for the fractal construction. See run.py 95 | for more details. 96 | 97 | Returns: 98 | np.array of (float, int) [args.resolution, args.resolution, image.n_channels]: 99 | Array representing the generated fractal image. 100 | tuple (np.array, np.array, np.array): Parameters of the IFS that constructed 101 | the fractal: w [n, 2, 2], b [n, 1, 2], p [n]. 102 | """ 103 | image = read_image(args.color_steal) 104 | w_fractal, b_fractal, p_fractal = build_ifs(args) 105 | w_color, b_color, _ = sample_ifs(w_fractal.shape[0]) 106 | buffer_fractal, buffer_color = [], [] 107 | 108 | batch_fractal = np.random.uniform( 109 | size=[args.batch_size, 2]).astype(np.float32) 110 | batch_color = np.random.uniform( 111 | size=[args.batch_size, 2]).astype(np.float32) 112 | 113 | # 2 IFSs are necessary: one for the constructed fractal and one for the given image 114 | # whose color patterns are being copied. 115 | 116 | for step in loop_wrapper(range(args.n_iter), args=args): 117 | ifs_idxs = np.random.choice( 118 | w_fractal.shape[0], size=args.batch_size, p=p_fractal) 119 | next_batch_fractal, next_batch_color = [], [] 120 | 121 | for ifs_idx in range(w_fractal.shape[0]): 122 | next_batch_fractal.append( 123 | np.matmul(batch_fractal[ifs_idxs == ifs_idx], w_fractal[ifs_idx]) + b_fractal[ifs_idx]) 124 | next_batch_color.append( 125 | np.matmul(batch_color[ifs_idxs == ifs_idx], w_color[ifs_idx]) + b_color[ifs_idx]) 126 | 127 | batch_fractal = np.concatenate(next_batch_fractal, axis=0) 128 | batch_color = np.concatenate(next_batch_color, axis=0) 129 | 130 | # The initial iterations are ignored as the coordinates have not converged yet. 131 | if step > args.n_ignore: 132 | buffer_fractal.append(batch_fractal) 133 | buffer_color.append(batch_color) 134 | 135 | canvas_shape = [args.resolution, args.resolution, image.shape[2]] 136 | canvas = np.zeros(shape=canvas_shape, dtype=image.dtype) 137 | 138 | min_fractal, max_fractal = find_min_max(buffer_fractal) 139 | min_color, max_color = find_min_max(buffer_color) 140 | image_res = np.array(image.shape[:2]) 141 | 142 | for batch_fractal, batch_color in zip(buffer_fractal, buffer_color): 143 | batch_fractal = (batch_fractal - min_fractal) / \ 144 | (max_fractal - min_fractal) 145 | batch_fractal = np.clip( 146 | (batch_fractal * args.resolution).astype(int), a_min=0, a_max=args.resolution - 1) 147 | 148 | batch_color = (batch_color - min_color) / (max_color - min_color) 149 | batch_color = np.clip( 150 | (batch_color * image_res).astype(int), a_min=0, a_max=image_res - 1) 151 | 152 | canvas[ 153 | batch_fractal[:, 0], batch_fractal[:, 1]] = image[batch_color[:, 0], batch_color[:, 1]] 154 | 155 | canvas = np.rot90(canvas) 156 | 157 | return canvas, (w_fractal, b_fractal, p_fractal) 158 | 159 | 160 | def fractal_flame(args): 161 | """Constructs a colorful fractal using a smplified Fractal Flame Algorithm: 162 | 163 | https://flam3.com/flame_draves.pdf 164 | 165 | Args: 166 | args (argparse.Namespace): Arguments for the fractal construction. See run.py 167 | for more details. 168 | 169 | Returns: 170 | np.array of (float, int) [args.resolution, args.resolution, 3]: Array representing 171 | the generated fractal image. 172 | tuple (np.array, np.array, np.array): Parameters of the IFS that constructed 173 | the fractal: w [n, 2, 2], b [n, 1, 2], p [n]. 174 | """ 175 | w, b, p = build_ifs(args) 176 | colors = np.random.uniform(size=[w.shape[0], 3]) 177 | coord_buffer, idx_buffer = [], [] 178 | coord_batch = np.random.uniform( 179 | size=[args.batch_size, 2]).astype(np.float32) 180 | 181 | for step in loop_wrapper(range(args.n_iter), args=args): 182 | idx_batch = np.random.choice(w.shape[0], size=args.batch_size, p=p) 183 | next_coord_batch = [] 184 | 185 | for ifs_idx in range(w.shape[0]): 186 | next_coord_batch.append( 187 | np.matmul(coord_batch[idx_batch == ifs_idx], w[ifs_idx]) + b[ifs_idx]) 188 | 189 | coord_batch = np.concatenate(next_coord_batch, axis=0) 190 | 191 | # The initial iterations are ignored as the coordinates have not converged yet. 192 | if step > args.n_ignore: 193 | coord_buffer.append(coord_batch) 194 | idx_buffer.append(idx_batch) 195 | 196 | # The paper claims that drawing inside a grid with larger resolution followed by 197 | # downsampling leads to better results. 198 | sup_res = args.sup * args.resolution 199 | canvas_shape = [sup_res, sup_res, 3] 200 | canvas = np.zeros(shape=canvas_shape, dtype=np.float32) 201 | freq = np.ones(shape=canvas_shape[:-1], dtype=np.float32) 202 | 203 | min_, max_ = find_min_max(coord_buffer) 204 | 205 | for coord_batch, idx_batch in zip(coord_buffer, idx_buffer): 206 | coord_batch = (coord_batch - min_) / (max_ - min_) 207 | coord_batch = np.clip( 208 | (coord_batch * sup_res).astype(int), a_min=0, a_max=sup_res - 1) 209 | 210 | freq[coord_batch[:, 0], coord_batch[:, 1]] += 1 211 | canvas[coord_batch[:, 0], coord_batch[:, 1]] = ( 212 | canvas[coord_batch[:, 0], coord_batch[:, 1]] + colors[idx_batch]) / 2. 213 | 214 | block_size = (args.sup, args.sup, 1) 215 | freq = skimage.measure.block_reduce( 216 | freq, block_size=block_size[:2], func=np.mean) 217 | canvas = skimage.measure.block_reduce( 218 | canvas, block_size=block_size, func=np.mean) 219 | 220 | alpha = np.log(freq[..., None]) / np.log(freq.max()) 221 | 222 | canvas = canvas * alpha ** (1/args.gamma) 223 | 224 | canvas = np.rot90(canvas) 225 | 226 | return canvas, (w, b, p) 227 | 228 | 229 | def build_fractal(args): 230 | assert not (args.color_steal and args.flame), \ 231 | 'Cannot use both color stealing and fractal flame. Pick one.' 232 | 233 | if args.color_steal: 234 | fractal = color_steal(args) 235 | elif args.flame: 236 | fractal = fractal_flame(args) 237 | else: 238 | fractal = binary_fractal(args) 239 | 240 | return fractal 241 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Color Stealing
3 |

4 | 5 |

6 | 7 | 8 | 9 | 10 |

11 | 12 | Python implementation of the [Color Stealing algorithm](https://maths-people.anu.edu.au/~barnsley/pdfs/fractal_tops.pdf). In short, this technique constructs aesthetically pleasing fractals by copying color patterns from a given auxiliary image to a binary fractal. 13 | 14 | 15 | 16 |

17 | 18 | Definitely not a cherry-picked sample. 19 |

20 | 21 | 22 | 23 | 24 | Table of contents 25 | === 26 | 27 | 28 | * [➤ Summary](#summary) 29 | * [➤ Generated Samples](#generated-samples) 30 | * [➤ Installation](#installation) 31 | * [➤ Usage](#usage) 32 | * [➤ Contact](#contact) 33 | * [➤ Citations](#citations) 34 | 35 | 36 | 37 | 38 | Summary 39 | === 40 | 41 | Perhaps the most simple method to construct a fractal image is the [Chaos Game](https://en.wikipedia.org/wiki/Chaos_game). A fractal can be defined by its [iterated function system](https://en.wikipedia.org/wiki/Iterated_function_system) (IFS), which is a set of n functions. For images, each function is with a corresponding probability . The Chaos Game begins by sampling a random 2d coordinate . At the j-th iteration, an integer is sampled based on the distribution p. The next coordinate is computed as . This coordinate is then plotted on a 2d grid, which was initially empty. After a number of iterations, the result is a binary image. Examples of such images can be found in the second column of the [generated samples](#generated-samples) as well as at `templates/images`. 42 | 43 | 44 | 45 | The [Color Stealing algorithm](https://maths-people.anu.edu.au/~barnsley/pdfs/fractal_tops.pdf) extends the Chaos Game by adding color to the constructed fractal. This requires an auxiliary image as input. Specifically, two IFSs are kept: one with functions and probabilities for the fractal image and one with functions and no probabilities for the auxiliary image. Similarly, two coordinates are initially sampled: . At the j-th iteration, an integer is likewise sampled from the distribution p, which is followed by calculations and . Then the fractal is extended: . This process eventually results in images such as the third column of [generated samples](#generated-samples). 46 | 47 | 48 | 49 | 50 | 51 | 52 | Generated samples 53 | === 54 | Below is a list of examples constructed by the provided scripts. Each sample was generated using the command `python run.py -s -i 100000 -nt -l -c `, where `` was chosen from `templates/ifs` and `` from `assets/auxiliary`. Running this commands produces a different result each time, due to rng. Obviously, all the examples are cherry-picked. 55 | 56 | |Auxiliary Image | Binary Fractal | Color Stealing | 57 | | :--: |:--:|:--:| 58 | |||| 59 | |||| 60 | |||| 61 | |||| 62 | |||| 63 | |||| 64 | |||| 65 | |||| 66 | |||| 67 | |||| 68 | 69 | 70 | 71 | 72 | Installation 73 | === 74 | ``` 75 | git clone https://github.com/davidsvy/color-stealing 76 | cd color-stealing 77 | pip install -r requirements.txt 78 | ``` 79 | 80 | 81 | 82 | 83 | Usage 84 | === 85 | ``` 86 | python run.py OPTIONS 87 | ``` 88 | 89 | ## Saving and rendering: 90 | -s, --save [FILE_NAME] If provided, saves the image and the IFS. 91 | If FILE_NAME is not given, the image will 92 | be saved at DIR/images/TIMESTEP.png and 93 | the IFS at DIR/ifs/TIMESTEP.csv. DIR is 94 | the next argument and TIMESTEP is the 95 | timestep at the time of saving the files. If 96 | FILE_NAME is given, the image will be saved at 97 | DIR/images/FILE_NAME.png an the IFS at 98 | DIR/ifs/FILE_NAME.csv. For the script to run, 99 | either -p or -s must be provided. 100 | 101 | -d, --dir DIR Directory where the image & the IFS file will 102 | be saved. 103 | 104 | -p, --plot If given, the constructed fractal will be 105 | rendered using plt.imshow(). For the script 106 | to run, either -p or -s must be provided. 107 | 108 | -cm, --cmap CMAP cmap for for plt.imshow(). Accepted values are 109 | 'i', 'p', 'm', 'c', 'v'. Default value is 'i'. 110 | CMAP is ignored if either -f or -c is provided. 111 | 112 | 113 | ## Fractal parameters: 114 | -r, --resolution RES Resolution of the square fractal image. Default 115 | value is 1024. 116 | 117 | -b, --batch_size BS Number of points calculated at each iteration. 118 | If -f is given, setting BS <= 4 might result in 119 | better visuals. Default value is 128. 120 | 121 | -i, --n_iter N_ITER Number of iterations for the chaos game algorithm. 122 | Default value is 50000. 123 | 124 | -ni, --n_ignore N_IGNORE Number of initial iterations that will not be 125 | rendered. Default value is 200. 126 | 127 | -nt, --no_tqdm If given, the tqdm progress bar will not be used. 128 | 129 | 130 | ## Loading saved IFS: 131 | -l, --load PATH If not provided, the scripts will sample a random IFS. 132 | If provided, the fractal stored inside PATH will be 133 | generated. PATH must be a path to a valid IFS csv 134 | file. 135 | 136 | -m, --mutate PATH Same as the previous argument, with the difference 137 | that the loaded IFS will be slightly mutated in a 138 | random fashion. 139 | 140 | 141 | ## Color Stealing: 142 | -c, --color_steal PATH If not provided (and -f not provided), a binary 143 | fractal will be generated. If provided, the fractal 144 | will be constructed by copying color patterns from 145 | the image stored at PATH using the Color Stealing 146 | algorithm. 147 | 148 | 149 | ## Fractal Flame: 150 | -f, --flame If not provided (and -c not provided), a binary 151 | fractal will be generated. If provided, the image 152 | will be generated using the Fractal Flame 153 | algorithm. Unfortunately, this mechanic is not 154 | working well yet. Setting BS <= 4 might result in 155 | better results. 156 | 157 | -g, --gamma GAMMA Gamma parameter for the fractal frame algorithm. 158 | Default value is 20. 159 | 160 | -su, --sup SUP Supersampling ratio for the fractal flame algorithm. 161 | Default value is 3. 162 | 163 | 164 | 165 | Contact 166 | === 167 | The author of this repo can be mailed at [dsvyezhentsev@gmail.com](mailto:dsvyezhentsev@gmail.com). 168 | 169 | 170 | Citations 171 | === 172 | 173 | ```bibtex 174 | @inproceedings{Barnsley2003ERGODICT, 175 | title={ERGODIC THEORY , FRACTAL TOPS AND COLOUR}, 176 | author={Michael F. Barnsley}, 177 | year={2003} 178 | } 179 | 180 | ``` 181 | 182 | --------------------------------------------------------------------------------