|
From: Pierre H. <pie...@cr...> - 2012-10-04 09:02:58
|
Hi Fernando, Le 04/10/2012 09:16, Fernando Perez a écrit : > This would make for an awesome couple of examples for the gallery, the > mathematica solutions look really pretty cool: > > http://mathematica.stackexchange.com/questions/11350/xkcd-style-graphs I've never used Mathematica so that it's pretty difficult for me to understand the following lines of code which I guess do the main job of distorting the image xkcdDistort[p_] := Module[{r, ix, iy}, r = ImagePad[Rasterize@p, 10, Padding -> White]; {ix, iy} = Table[RandomImage[{-1, 1}, ImageDimensions@r]~ImageConvolve~ GaussianMatrix[10], {2}]; ImagePad[ImageTransformation[r, # + 15 {ImageValue[ix, #], ImageValue[iy, #]} &, DataRange -> Full], -5]]; Is there somebody there that can describe this algorithm with words (English or Python ;-)) ? I feel like the key point is about adressing the rasterized plot image "r" with some slightly randomized indices "ix" and "iy". However, I really don't get the step that generates these indices. Best, Pierre |