⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f_spiht_main.m

📁 SPIHT的MATLAB源代码,希望对有需要的朋友有所帮助.
💻 M
字号:
function [Orig_I,img_spiht]=f_SPIHT_Main(in_file,out_file,nRow,nColumn,level,rate,out_stream)
% Matlab implementation of SPIHT (without Arithmatic coding stage)
%
% Main function 
%
% input:    in_file : the original image file.
%           out_file: the decompression image file
%            nRow: 
%            nColumn:
%            levels:
%            rate:bits per pixel
%            out_stream:decompression file stream
%            
% output:    Orig_I
%            img_spiht 
%

%-----------   Input   ----------------
Orig_I = func_ReadRaw(in_file,nRow,nColumn);
imshow(Orig_I,[])
% mm1=La_Shen(Orig_I,nColumn,nRow,0,255);

%-----------   Pre-processing   ----------------
image_spiht = zeros(nRow,nColumn);
% image_spiht = zeros(nColumn,nRow);
% "image " is the input of codec

%-----------   Wavelet Decomposition   ----------------

I_W=d2fldwt9_7(Orig_I, level);
%-----------   Coding   ----------------
tic;
func_SPIHT_Enc(I_W,level,rate,out_stream);
tt(1)=toc;
%-----------   Decoding   ----------------
tic;
img_dec = func_SPIHT_Dec(out_stream);
tt(2)=toc;
%-----------   Wavelet Reconstruction   ----------------
img_spiht=d2bldwt9_7(img_dec,level);

%-----------  output image file ----------------
func_WriteRaw(img_spiht,out_file);

%-----------   PSNR analysis   ----------------
Q = 255;
OrigSize = nRow*nColumn;
MSE = sum(sum((img_spiht - Orig_I) .^ 2)) / OrigSize;
psnr = 10*log10(Q*Q/MSE)
subplot(1,2,1)
[low,high]=La_Shen(Orig_I,nRow,nColumn);
imshow(Orig_I,[low high])
% imshow(mm1,[0 255])
subplot(1,2,2)
[low,high]=La_Shen(img_spiht,nRow,nColumn);
imshow(img_spiht,[])
% imshow(mm2,[0 255])
disp(tt)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -