%% ratedistortion.m % show image and family of thresholded images % show the rate distorion curve for the family of images % use the DFT % S. Allen Broughton %% get image %load clown load mandrill %X = zeros(128,128); X(61:80,41:80)=1; %% find parameters and DFT of X X= X-mean(X(:)); % eliminate DC coefficient [m,n] = size(X); N = m*n; fX = fft2(X); % get 2D FFT of image afX = abs(fX); % a convenient variable M = max(abs(fX(:))); % get maximum amplitude; %% set up "movie" plevels = [0, (1:9)/1000 (1:9)/100 ,(1:9)/10, 1:9 ]; E = energy(X); Dist = [ ]; PRC = [ ]; eps = 10^(-5); %% movie for pL = plevels PercentThresholdofMaximum = pL; cutlevel = pL*M/100; J = find(afX