Advertisement
Matthen

Diffusion Image

Jun 7th, 2011
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. diffuse[point_, t_] :=
  2. Total[Join[{point},
  3. RandomReal[NormalDistribution[0, 0.5], {t, 2}]]];
  4. img = ImageCrop[
  5. Rasterize[
  6. Graphics[Text[Style["diffusion", FontSize -> 100], {0, 0}]]]];
  7. imgdata = ImageData[img];
  8. time[x_, \[Alpha]_, \[Beta]_] :=
  9. Module[{g = x/Length[imgdata[[1]]]},
  10. Floor[\[Alpha] Abs[g]^\[Beta] + 1]];
  11. coords = Flatten[
  12. Table[{{i, -j}, imgdata[[j]][[i]]}, {j, Length[imgdata]}, {i,
  13. Length[imgdata[[1]]]}], 1];
  14. frame[\[Alpha]_, \[Beta]_] :=
  15. Module[{points, diffused},
  16. points = Map[#[[1]] &, Select[coords, Norm[#[[2]] ] < 0.01 &]];
  17. diffused =
  18. Map[{ColorData["TemperatureMap"][#[[1]]/Length[imgdata[[1]]]],
  19. Point[diffuse[#, time[#[[1]], \[Alpha], \[Beta]]]]} &, points];
  20. Graphics[diffused, Background -> Black, ImageSize -> {1000}]];
  21.  
  22. frame[200, 2.5]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement