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

📄 func_spiht_main.m

📁 matlab 的spiht 编码 现在编码很使用的
💻 M
字号:
function func_SPIHT_Main
% Matlab implementation of SPIHT (without Arithmatic coding stage)
%
% Main function 
%
% input:    Orig_I : the original image.
%           rate : bits per pixel
% output:   img_spiht 
%
% Jing Tian
% Contact me : scuteejtian@hotmail.com
% This program is part of my undergraduate project in GuangZhou, P. R. China.
% April - July 1999

%-----------   Input   ----------------
Orig_I = func_ReadRaw('lena512.raw', 512*512, 512, 512);
rate = 0.1;

%-----------   Pre-processing   ----------------

OrigSize = size(Orig_I, 1);
max_bits = floor(rate * OrigSize^2);

OutSize = OrigSize;
image_spiht = zeros(size(Orig_I));
% "image " is the input of codec
[nRow, nColumn] = size(Orig_I);


%-----------   Wavelet Decomposition   ----------------
n = size(Orig_I,1);
n_log = log2(n); 
level = n_log;
% wavelet decomposition level can be defined by users manually.

type = 'bior4.4';
[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters(type);

[I_W, S] = func_DWT(Orig_I, level, Lo_D, Hi_D);

%-----------   Coding   ----------------
img_enc = func_SPIHT_Enc(I_W, max_bits, nRow*nColumn, level);   

%-----------   Decoding   ----------------
img_dec = func_SPIHT_Dec(img_enc);

%-----------   Wavelet Reconstruction   ----------------
img_spiht = func_InvDWT(img_dec, S, Lo_R, Hi_R, level);

%-----------   PSNR analysis   ----------------
Q = 255;
MSE = sum2((img_spiht - Orig_I) .^ 2) / nRow / nColumn;
psnr = 10*log10(Q*Q/MSE)

⌨️ 快捷键说明

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