How to perform ifft2 with phase and magnitude

10 次查看(过去 30 天)
Hi. I really tried to find the answer for my questions but I didn't find it online.
So I have two images which correspond to the magnitude and phase following a Fourier transform of an image. Now I want to write a function to convert the magnitude image and phase image into the original image in spatial domain. The question also states that "For the phase image, 0 corresponds to –pi and 255 corresponds to +pi. All values in between have been linearly interpolated between –pi and pi and For the magnitude image, the intensities were log-transformed prior to saving the image, where 0 corresponds to e0 and 255 corresponds to e18."
Here is what I tried:
m1 = double(imread('magnitude1.tif'));
p1 = double(imread('phaseD.tif'));
newfft = m1.* exp(1i*p1);
out = ifft2(newfft);
My problem is I don't know how to change the values from 0 to 255 to be - pi to pi.
Any ideas would be appreciated.

回答(1 个)

Walter Roberson
Walter Roberson 2016-9-26
((double(p1) / 255 * 2 - 1) * pi
Or you might prefer
double(p1) / 255 * 2 * pi - pi

类别

Help CenterFile Exchange 中查找有关 Geometric Transformation and Image Registration 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by