How to perform ifft2 with phase and magnitude

2 ビュー (過去 30 日間)
Changoleon
Changoleon 2016 年 9 月 25 日
回答済み: Walter Roberson 2016 年 9 月 26 日
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

Community Treasure Hunt

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

Start Hunting!

Translated by