The following is a question I got in my school assignment.

Pick an image and follow the operations

  1. Multiply image by (−1)x+y.
  2. Compute the DFT.
  3. Take the complex conjugate of the transform.
  4. Compute the IDFT.
  5. 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 np.fft.fft2)

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.

The output I got is this: enter image description here

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))
  • $\begingroup$ Hmmmm, have you checked wikipedia? $\endgroup$ – Marcus Müller Jan 17 '19 at 7:43
  • $\begingroup$ That was rude. Why are stack exchange communities so toxic?!!. And yes, I've checked Wikipedia -_- $\endgroup$ – icyfire Jan 17 '19 at 7:44
  • $\begingroup$ that wasn't meant to be rude, but helpful. It's up to you to take the help you're getting here as positively as it's meant. Please don't try to accuse me of rudeness when I point you to resources as first interaction on this site; that would be what I call toxic, if I was any thin-skinned. Have a great day! $\endgroup$ – Marcus Müller Jan 17 '19 at 8:23
  • $\begingroup$ The question is, have you tried yourself to look at it from a theoretical mathematical point of view taking the characteristics of the FT(see Marcus link) into account? And if so, at what point did you get stuck? If you are really interested in it, you should investigate yourself as far as you can, not just asking to get the answer without any effort. $\endgroup$ – Irreducible Jan 17 '19 at 12:22
  • $\begingroup$ Hi There is absolutely nothing rude about @MarcusMüller 's comment. And that's the very response we shall put. Let me ask the similar question: your answer lies in the DFT properties; in particular those of symmetry properties which relate DFT of $x[-n], x[n]^*, x[-n]^*$ to that of $x[n]$... If you write down all those properties you will immediately see the answer by your self too. NOTE: as you guessed correctly, multiplication by $(-1)^{x+y}$ is a distraction, get rid of them. $\endgroup$ – Fat32 Jan 17 '19 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.