pkg load image
clear all
name = './armour_head.png'
% original image
ima = imread( name );
ima = im2double(ima);
N = size(ima,1)
% D4
fd4 = [ 1-sqrt(3), sqrt(3)-3, 3+sqrt(3), -1-sqrt(3)]/4/sqrt(2);
% D6
fd6 = [0.47046721, 1.14111692 , 0.650365, -0.19093442, -0.12083221, 0.0498175 ];
fd6 = -fliplr(fd6)/sqrt(2).*(-1).^[1:size(fd6,2)];
% D8
fd8 = [0.32580343 , 1.01094572 , 0.89220014, -0.03957503 , -0.26450717 , 0.0436163 , 0.0465036, -0.01498699];
fd8 = -fliplr(fd8)/sqrt(2).*(-1).^[1:size(fd8,2)];
% D12
fd12 = [0.15774243 , 0.69950381 ,1.06226376 , 0.44583132, -0.31998660, -0.18351806 , 0.13788809 , 0.03892321 , -0.04466375 , 7.83251152e-4, 6.75606236e-3, -1.52353381e-3 ];
fd12 = -fliplr(fd12)/sqrt(2).*(-1).^[1:size(fd12,2)];
% Haar
haar = [1,-1]/sqrt(2);
%%%%%%%%%%%%%%%%%%%%%%%
% D4 k=2
%%%%%%%%%%%%%%%%%%%%%%%
% parameters
k = 2;
f = fd4;
% algorithm
temp = wav_im_t(ima,f,k);
temp(1:N/2^k,1:N/2^k) = zeros(N/2^k);
temp = im2double(mat2gray( -abs(wav_im_i(temp,f,k)) ));
imwrite(temp,'./ed_d4_2.png');
%%%%%%%%%%%%%%%%%%%%%%%
% D4 k=3
%%%%%%%%%%%%%%%%%%%%%%%
% parameters
k = 3;
f = fd4;
% algorithm
temp = wav_im_t(ima,f,k);
temp(1:N/2^k,1:N/2^k) = zeros(N/2^k);
temp = im2double(mat2gray( -abs(wav_im_i(temp,f,k)) ));
imwrite(temp,'./ed_d4_3.png');
%%%%%%%%%%%%%%%%%%%%%%%
% D6 k=3
%%%%%%%%%%%%%%%%%%%%%%%
% parameters
k = 3;
f = fd6;
% algorithm
temp = wav_im_t(ima,f,k);
temp(1:N/2^k,1:N/2^k) = zeros(N/2^k);
temp = im2double(mat2gray( -abs(wav_im_i(temp,f,k)) ));
imwrite(temp,'./ed_d6_3.png');
%%%%%%%%%%%%%%%%%%%%%%%
% D8 k=7 (metallic, maximal)
%%%%%%%%%%%%%%%%%%%%%%%
% parameters
k = 7;
f = fd8;
% algorithm
temp = wav_im_t(ima,f,k);
temp(1:N/2^k,1:N/2^k) = zeros(N/2^k);
temp = im2double(mat2gray( -abs(wav_im_i(temp,f,k)) ));
imwrite(temp,'./ed_d8_7.png');
%%%%%%%%%%%%%%%%%%%%%%%
% D12 k=6 (metallic, maximal)
%%%%%%%%%%%%%%%%%%%%%%%
% parameters
k = 6;
f = fd12;
% algorithm
temp = wav_im_t(ima,f,k);
temp(1:N/2^k,1:N/2^k) = zeros(N/2^k);
temp = im2double(mat2gray( -abs(wav_im_i(temp,f,k)) ));
imwrite(temp,'./ed_d12_6.png');
%%%%%%%%%%%%%%%%%%%%%%%
% D4 k=6
%%%%%%%%%%%%%%%%%%%%%%%
% parameters
k = 6;
f = fd4;
% algorithm
temp = wav_im_t(ima,f,k);
temp(1:N/2^k,1:N/2^k) = zeros(N/2^k);
temp = wav_im_i(temp,f,k);
imwrite(temp,'./ed_d4_6.png');
%%%%%%%%%%%%%%%%%%%%%%%
% D6 k=4
%%%%%%%%%%%%%%%%%%%%%%%
% parameters
k = 4;
f = fd6;
% algorithm
temp = wav_im_t(ima,f,k);
temp(1:N/2^k,1:N/2^k) = zeros(N/2^k);
temp = im2double(mat2gray( -abs(wav_im_i(temp,f,k)) ));
imwrite(temp,'./ed_d6_4.png');
|