How to perform ifft2 with phase and magnitude
5 次查看(过去 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.
0 个评论
回答(1 个)
Walter Roberson
2016-9-26
((double(p1) / 255 * 2 - 1) * pi
Or you might prefer
double(p1) / 255 * 2 * pi - pi
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!