|
From: Pierre H. <pie...@cr...> - 2012-10-04 14:35:14
|
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
|