On Thu, Oct 4, 2012 at 3:35 PM, Pierre Haessig <pierre.haes...@crans.org> wrote: > Le 04/10/2012 16:03, Jason Grout a écrit : >> f@r means f(r) >> >> a~ImageConvolve~b means ImageConvolve(a,b) (~ treats an operator as infix) >> >> Table[..., {2}] means [... for i in range(2)] >> >> #+1& is a lambda function lambda x: x+1 >> >> So I think it goes something like: >> >> def xkcdDistort(p): >> r = ImagePad(Rasterize(p), 10, Padding='White') >> (ix, iy) = [ImageConvolve(RandomImage([-1,1], ImageDimensions(r)), >> GaussianMatrix(10)) >> for i in range(2)] >> return ImagePad(ImageTransformation(r, >> lambda coord: (coord[0]+15*ImageValue(ix, coord), >> coord[1]+15*ImageValue(iy, coord)), >> DataRange='Full'), >> -5) > Thanks a lot! > > It's the first time I encounter Mathematica syntax. Some of these > functional notations are not so easy to follow for my unexperienced eyes > but it makes this Mathematica code nicely compact. > > So I think this code indeed resamples the rastered plot image on a > shaken coordinate grid. I kind of understand that the noise on > coordinates is spatially smoothed by a 10px Gaussian Point Spread > Function (if I understand correctly...) > > Best, > Pierre
Adding Gaussian noise to each point on a function doesn't look nice. That's why I produced a random function in Fourier space first. That way, random functions still have some sense of smoothness. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom ------------------------------------------------------------------------------ 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