import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg %matplotlib inline image = mpimg.imread('stock_bw_1.jpg') plt.imshow(image) #plt.imshow(image) human_readable_fimage = np.fft.fftshift(np.fft.fft2(image)) machine_readable_fimage = np.fft.fft2(image) #len(fimage), len(fimage[0]), fimage #plt.imshow(fimage) #plt.imshow(np.real(np.fft.ifft(fimage))) #plt.imshow(np.real(fimage)) plt.imshow(np.abs(human_readable_fimage)) plt.imshow(np.abs(np.fft.ifft2(machine_readable_fimage))) #len(machine_readable_fimage[0]) temp = np.zeros([len(machine_readable_fimage), len(machine_readable_fimage[0]),3]) #temp[:,0:50] = machine_readable_fimage[:,0:50] - works temp[400:450,0:100] = machine_readable_fimage[400:450,0:100] #temp[:,0:50].shape plt.imshow(np.abs(np.fft.ifft2(temp))) plt.imshow(np.abs(temp)) machine_readable_fimage.shape len(machine_readable_fimage)