Write an m-file "myfourier.m" which takes two images, computes FFT, phase and amplitude and swaps the amplitudes between two images.
function myfourier
im1=imread('cameraman.png');
imd1=double(im1);
im2=imread('class_f.png');
imd2=double(im2);
FI1=fft2(imd1);
phase1=angle(FI1);
amplitude1=abs(FI1);
FI2=fft2(imd2);
phase2=angle(FI2);
amplitude2=abs(FI2);
NFI1=amplitude1.*exp(i*phase1);
NFI2=amplitude2.*exp(i*phase2);
RI1=ifft2((NFI1));
RI2=ifft2((NFI2));
figure;imshow(real(RI1),[]);
figure;imshow(real(RI2),[]);
NFI1=amplitude1.*exp(i*phase2);
NFI2=amplitude2.*exp(i*phase1);
RI1=ifft2((NFI1));
RI2=ifft2((NFI2));
figure;imshow(real(RI1),[]);
figure;imshow(real(RI2),[]);
What information is encoded in the amplitude and phase?
How the change of phase and amplitude affects the transformed image?