% ============================================================================= % Math 336 - Image Processing - Laboratory 3 % % A Matlab script for computing the FFTs of the images in the warm up % exercies. % % Marty Kandes % Department of Physics % San Diego State University % Fall 2008 % ----------------------------------------------------------------------------- %clear all; close all; clc; %f = imread('machband.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; %M = 256; %N = 256; %f = zeros(M,N); %for I = 1:M % for J = 1:N % f(I,J) = 1 + sin(I*(pi/128))*cos(J*(pi/256)); % end; %end; %f = mat2gray(f); %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; M = 256; N = 256; f = ones(M,N); f = 0.5.*f; f = imnoise(f,'gaussian'); 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);