?? spiht_main.m
字號:
function Y_new = SPIHT_main(nFrame,filename)
%
% This function implements the 3D-SPIHT algorithm.
% input: filename: the video sequence in CIF,QCIF or SIF format
% nFrame: number of frames to read from the filename specified
% output: Y_new: the reconstructed video sequence
%
%
% Athanasopoulos Dionysios
% Postgraduate Student
% Computer Engineering and Informatics Dept.
% University of Patras, Greece
%
% reads the luminance (Y) component from the filename specified. The file must
% be of the format CIF, QCIF, SIF. It reads nFrame frames.
tic;
%Y = myfunc_read_cif(nFrame,filename);
x = double(dicomread('E:\3D-SPIHT\SE2\IM1'));
Y(:,:,1) = x;
x = double(dicomread('E:\3D-SPIHT\SE2\IM2'));
Y(:,:,2) = x;
x = double(dicomread('E:\3D-SPIHT\SE2\IM3'));
Y(:,:,3) = x;
x = double(dicomread('E:\3D-SPIHT\SE2\IM4'));
Y(:,:,4) = x;
x = double(dicomread('E:\3D-SPIHT\SE2\IM5'));
Y(:,:,5) = x;
x = double(dicomread('E:\3D-SPIHT\SE2\IM6'));
Y(:,:,6) = x;
x = double(dicomread('E:\3D-SPIHT\SE2\IM7'));
Y(:,:,7) = x;
x = double(dicomread('E:\3D-SPIHT\SE2\IM8'));
Y(:,:,8) = x;
outfilename1 = 'IM1_1_reconstruct.bmp';
outfilename2 = 'IM1_2_reconstruct.bmp';
outfilename3 = 'IM1_3_reconstruct.bmp';
outfilename4 = 'IM1_4_reconstruct.bmp';
outfilename5 = 'IM1_5_reconstruct.bmp';
outfilename6 = 'IM1_6_reconstruct.bmp';
outfilename5 = 'IM1_7_reconstruct.bmp';
outfilename6 = 'IM1_8_reconstruct.bmp';
% 3D - SPIHT encoder
type = 'bior4.4'; % type of filters for the decomposition
spatial_levels = 3; % levels of decomposition
%---------Wavelet Decomposition-----------------
for i=1:size(Y,3)
[video_seq(:,:,i) , S] = func_DWT(Y(:,:,i), spatial_levels, type);
end
% maximum bits for the 3D-SPIHT encoding
max_bits = 675840; % for exaple if we have 16 frames each 240x352 and use 0.5 bits per pixel max_bits = 675840
out = func_SPIHT_Enc(video_seq, max_bits,spatial_levels);
% 3D - SPIHT decoder
in = func_SPIHT_Dec(out,size(Y));
video_seq2 = in;
%--------------Wavelet Reconstruction------------
for i=1:size(video_seq2,3)
Y_new(:,:,i) = func_InvDWT(video_seq2(:,:,i), S, type, spatial_levels);
end
imwrite(Y_new(:,:,1),gray(256),outfilename1,'bmp');
imwrite(Y_new(:,:,2),gray(256),outfilename2,'bmp');
imwrite(Y_new(:,:,3),gray(256),outfilename3,'bmp');
imwrite(Y_new(:,:,4),gray(256),outfilename4,'bmp');
imwrite(Y_new(:,:,5),gray(256),outfilename5,'bmp');
imwrite(Y_new(:,:,6),gray(256),outfilename6,'bmp');
imwrite(Y_new(:,:,7),gray(256),outfilename7,'bmp');
imwrite(Y_new(:,:,8),gray(256),outfilename8,'bmp');
toc;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -