Borrar filtros
Borrar filtros

Image reconstruction only by its phase or magnitude

4 visualizaciones (últimos 30 días)
Mithra
Mithra el 17 de Nov. de 2013
Respondida: mugambi ndwiga el 20 de Abr. de 2017
I have an image, I separate its phase and magnitude using fft2 , then I try to reconstruct it
  1. Only by magnitude
  2. 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

Respuestas (1)

mugambi ndwiga
mugambi ndwiga el 20 de Abr. de 2017
Try using "imagesc" instead of "imshow"

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by