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

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to