The following is a question I got in my school assignment.
Pick an image and follow the operations
- Multiply image by (−1)x+y.
- Compute the DFT.
- Take the complex conjugate of the transform.
- Compute the IDFT.
- Multiply the real part of the result by (−1)x+y .
Compare the input image and output image.
I've written the code for transforms and the mentioned operation using numpy and python. (Used
Can someone help me explain (mathematically)
why the output image appears as it does? How does part (c) affect the transform? Also the multiplying by
-1^(x+y) does not make any difference. Why?
I'm a beginner in signal processing. Any help is appreciated.
import numpy as np img = plt.imread("Q2.tif") N,M = np.shape(img) i, j = np.meshgrid(np.arange(M), np.arange(N)) mult_factor = np.power( np.ones((N,M)) * -1 , i + j ) tmp = img * mult_factor print("Calculating DFT") dft = np.fft.fft2(tmp) print("Calculating inverse DFT") idft = np.fft.ifft2(dft.conj()) out_img = np.abs((mult_factor * idft.real) + (1j * idft.imag))