% ============================================================================= % Math 336 - Image Processing - Laboratory 3 % % A Matlab script for computing the FFTs of the lena barbara images. % % Marty Kandes % Department of Physics % San Diego State University % Fall 2008 % ----------------------------------------------------------------------------- %clear all; close all; clc; %f = imread('lena.jpg'); %f = mat2gray(f); %M = size(f,1); %N = size(f,2); %F = fft2(f,M,N); %F = fftshift(F); %S = log(1+abs(F)); %S = mat2gray(S); %P = atan2(imag(F),real(F)); %P = mat2gray(P); %figure; %subplot(1,3,1), imshow(f); %subplot(1,3,2), imshow(S); %subplot(1,3,3), imshow(P); %clear all; close all; clc; %f = imread('barbara.jpg'); %f = mat2gray(f); %M = size(f,1); %N = size(f,2); %F = fft2(f,M,N); %F = fftshift(F); %S = log(1+abs(F)); %S = mat2gray(S); %P = atan2(imag(F),real(F)); %P = mat2gray(P); %figure; %subplot(1,3,1), imshow(f); %subplot(1,3,2), imshow(S); %subplot(1,3,3), imshow(P); clear all; close all; clc; f = imread('lena.jpg'); g = imread('barbara.jpg'); f = mat2gray(f); g = mat2gray(g); F = fft2(f); G = fft2(g); H = abs(F).*exp(i.*atan2(imag(G),real(G))); h = ifft2(H); h = mat2gray(abs(h)); imshow(h);