11

だから私はこの「私」というイメージを持っています。F = fft2(I) を使用して 2D フーリエ変換を取得します。それを再構築するには、ifft2(F) に行くことができます。

問題は、F の a) 振幅成分と b) 位相成分のみからこの画像を再構成する必要があることです。フーリエ変換のこれら 2 つの成分を分離し、それぞれから画像を再構成するにはどうすればよいでしょうか?

abs() 関数と angle() 関数を使用して大きさと位相を取得しようとしましたが、位相 1 は適切に再構築されません。

ヘルプ?

4

2 に答える 2

11

Fと同じ大きさで0の位相を持つ1つの行列と、同じ位相Fで均一な大きさの別の行列が必要です。あなたが指摘したようabsに、あなたに大きさを与えます。均一な大きさの同じ位相行列を取得するには、を使用angleして位相を取得してから、位相を実数部と虚数部に分離する必要があります。

> F_Mag = abs(F); %# has same magnitude as F, 0 phase
> F_Phase = cos(angle(F)) + j*(sin(angle(F)); %# has magnitude 1, same phase as F
> I_Mag = ifft2(F_Mag);
> I_Phase = ifft2(F_Phase);
于 2011-10-14T05:32:38.917 に答える
2

この投稿に別の答えを出すには遅すぎますが、とにかく...

@ zhilevan、mtrwの回答を使用して私が書いたコードを使用できます:

image = rgb2gray(imread('pillsetc.png')); 
subplot(131),imshow(image),title('original image');
set(gcf, 'Position', get(0, 'ScreenSize')); % maximize the figure window
%:::::::::::::::::::::
F = fft2(double(image));
F_Mag = abs(F); % has the same magnitude as image, 0 phase 
F_Phase = exp(1i*angle(F)); % has magnitude 1, same phase as image
% OR: F_Phase = cos(angle(F)) + 1i*(sin(angle(F)));
%:::::::::::::::::::::
% reconstruction
I_Mag = log(abs(ifft2(F_Mag*exp(i*0)))+1);
I_Phase = ifft2(F_Phase);
%:::::::::::::::::::::
% Calculate limits for plotting
% To display the images properly using imshow, the color range
% of the plot must the minimum and maximum values in the data.
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
% because the magnitude and phase were switched, the image will be complex.
% This means that the magnitude of the image must be taken in order to
% produce a viewable 2-D image.
subplot(132),imshow(abs(I_Mag),[I_Mag_min I_Mag_max]), colormap gray 
title('reconstructed image only by Magnitude');
subplot(133),imshow(abs(I_Phase),[I_Phase_min I_Phase_max]), colormap gray 
title('reconstructed image only by Phase');
于 2013-11-09T08:16:50.063 に答える