Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from numpy import *
- from scipy import interpolate as irp
- w = 61
- t = linspace(-1,1,w)
- xx,yy = meshgrid(t,t)
- xx,yy = xx.flatten(), yy.flatten()
- P = c_[sign(xx)*abs(xx)**0.65, sign(yy)*abs(yy)**0.65]
- del t
- x = random.randint( 0, 255, (2*w**2,w**2) ).astype(uint8)
- xo = zeros(x.shape,dtype=uint8)
- for i in range(x.shape[0]):
- f = irp.LinearNDInterpolator( P, x[i,:] )
- out = f( xx, yy )
- xo[i,:] = out
- del f, out
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement