Question

I have 256x256 image array (named Mydata) and I applied FFT transformation as fftshift(log1p(abs(fft2(Mydata))));

How to inverse the transformation and image the results in MATLAB?

Was it helpful?

Solution

To fully reconstruct the image you will also need the phase. If you recall the properties of the Fourier Transform, you can decompose any signal into its magnitude and phase counterparts. What you have in this code is just the magnitude. Without the phase, you cannot faithfully reconstruct your signal. As such, you'll need to store the phase somewhere. Remember that any complex number num can be represented in Euler form, such that:

 num <-> abs(num)*exp(j*angle(num));

abs is the magnitude of num and angle is the phase of num. Now, supposing you stored the magnitude and phase:

  magData = abs(MyData);
  phaseData = angle(MyData);

Coincidentally, angle is the MATLAB function that determines the phase of every element in a complex-valued matrix. To achieve the inverse operation, you would simply reverse the operations that you did above to achieve the original image:

  ifft2(expm1(ifftshift(magData.*exp(j*phaseData))));

expm1 is the MATLAB operation that performs the inverse of log1p.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top