Image reconstruction only by its phase or magnitude
18 次查看(过去 30 天)
显示 更早的评论
I have an image, I separate its phase and magnitude using fft2 , then I try to reconstruct it
- Only by magnitude
- Only by phase
Here is my code:
image = rgb2gray(imread('pillsetc.png'));
F = fft2(double(image));
F_Mag = abs(F);
F_Phase = exp(1i*angle(F));
% reconstructin
I_Mag = ifft2(log(F_Mag+1));
I_Phase = ifft2(F_Phase);
% Calculate limits for plotting
I_Mag_min = min(min(abs(I_Mag)));
I_Mag_max = max(max(abs(I_Mag)));
I_Phase_min = min(min(abs(I_Phase)));
I_Phase_max = max(max(abs(I_Phase)));
% Display reconstructed images
subplot(121),imshow(abs(I_Mag),[I_Mag_min I_Mag_max]), colormap gray
title('reconstructed image only by Magnitude');
subplot(122),imshow(abs(I_Phase),[I_Phase_min I_Phase_max]), colormap gray
title('reconstructed image only by Phase');
But I don't know what is the problem with reconstruction by magnitude that it only shows a totally black image!!! What's wrong with the code? How can I fix it?
Thanks in advance
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!