Iterated Function Systems (IFS)

Systèmes de fonctions itérées.

Code Mathematica :

IFS–Matrix[iter_,a_,b_] := (
  Clear[s];
  image = Image[
    RandomInteger[{0,255}, {512,512}], "Byte",
    ColorSpace->"Graylevel"];
  {n,m} = Dimensions[a];
  dim = ImageDimensions[image] / {n,m};
  s = Table[image, {n}, {m}];
  Do[(
    img = ImageResize[image, dim];
    For[i = 1, i <= n, i++,
      For[j = 1, j <= m, j++,
         s[[i]][[j]]=
           ImageMultiply[
            ImageAdd[img, b[[i]][[j]]], a[[i]][[j]]
            ];
         ];
      ];
    image = ImageAssemble[s];
    ), {iter}];
  image)
 
IFS–Matrix–Random[iter_:10,n_:2,m_:2] := (
	  a = RandomReal[{0.5,1.5}, {n,m}];
	  b = RandomReal[{-0.2,0.2}, {n,m}];
	  IFS–Matrix[iter, a, b]
  )
 
IFS–tab = Table[IFS–Matrix–Random[10, 2, 2], {3}]
 
Table[ColorCombine[RandomSample[IFS–tab,3]], {10}]
 
Manipulate[
	IFS–Matrix–Random[i,n,m],
	{i,1,20,1},
	{n,1,8,1},
	{m,1,8,1}
]

Téléchargement : IFS-Matrix.nb