Image reconstruction only by its phase or magnitude
20 views (last 30 days)
Show older comments
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 Comments
Answers (1)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!