% EE 438 Digital Signal Processing with Applications - Spring 2001 % 2-D signals and systems % Image display within Matlab %--------------------------------------------------------------- % Initialize clear all; close all %--------------------------------------------------------------- %Initialize colormap mcomp = 0 : 1.0 ./ 255 : 1.0; % output colors lie in [0,1] map = [mcomp' mcomp' mcomp']; M = 8; % size of image M2 = M/2; X = 6; % width of rect X2 = X/2; rect1d = zeros(M,1); rect1d(M2-X2+1:M2+X2) = ones(X,1); f=rect1d*rect1d'; h=[ 0 -.5 0 ; 0.5 1 0.5 ; 0 -.5 0]; g=conv2(f,h); %figure(1); %image(g*255); %colormap(map); %axis('off'); %axis('image'); %g = fftshift(g); H = fft2(h,256,256); H = fftshift(H); Hmag = abs(H); Hmax = max(max(Hmag)); decade = 2; Hmag = Hmag/Hmax*10^decade+1; Hmag = log10(Hmag); Hmax = max(max(Hmag)); %figure(2); image(Hmag*255/Hmax); colormap(map); axis('off'); axis('image');