resX,resY=1280,1024
X,Y = np.meshgrid(np.linspace(0,resX,resX,endpoint=False),np.linspace(0,resY,resY,endpoint=False))
D = np.zeros_like(X)
D[(X-resX/2)**2+(Y-resY/2)**2<resX*resY/8]=1
imgArray=np.round(np.stack([D,D,D], axis=2)*255).astype(np.uint8)
imgArray
img = Image.fromarray(imgArray)
img.save("out.png",format="PNG")
D=np.sqrt(D)
FFT = np.fft
outFFT = FFT.ifft2(D)
arg = np.angle(outFFT)
for i in range(len(arg)):
for j in range(len(arg[i])):
argLocal = arg[i][j]
if argLocal<0:
argLocal+=2*np.pi
arg[i][j]=max([0,argLocal])
imgArg = arg/(2*np.pi)*255
img2array1D = np.round(imgArg)
img2array = np.stack([img2array1D]*3, axis=2).astype(np.uint8)
img2 = Image.fromarray(img2array)
img2.save("out2.png",format="png")