📄 nstdhaarrec2.m
字号:
function a = nstdhaarrec2(x,level,rorc,h)
%nstdhaarrec2 二维非标准haar小波规格化分解后图像重构程序(多级)
%a = nstdhaarrec2(x,level)
%输入:x 载入的二维图像像数值;
% level 分解重构层数
% rorc 作行变换(1)或列变换(2),缺省为0,行列变换都做
% h 重构的矩阵块大小,缺省为整个x矩阵的变换
%输出:a 重构后生成的图像像数数值矩阵,大小与x相同,
a=double(x);
if nargin==1
level=1;
rorc=0;
h=size(x,2);
else
if nargin==2
h=size(x,2);
rorc=0;
else
if nargin==3
h=size(x,2);
end
end
end
h1=h;
h2=h*(2^(level-1));
while h1<=h2
if rorc==1
for j=1:h1
tempcol=a(1:h1,j)';
a(1:h1,j)=haarrec(tempcol,h1)';
end
else
if rorc==2
for i=1:h1
temprow=a(i,1:h1);
a(i,1:h1)=haarrec(temprow,h1);
end
else
for i=1:h1
temprow=a(i,1:h1);
a(i,1:h1)=haarrec(temprow,h1);
end
for j=1:h1
tempcol=a(1:h1,j)';
a(1:h1,j)=haarrec(tempcol,h1)';
end
end
end
h1=h1*2;
end
%--------------------------------------------------
% 内部程序
%--------------------------------------------------
function y=haarrec(x,h)
%haarrec 1-D haar reconstruct program
%a = haarrec(x,h)
%输入:x 载入的一维信号;
%输出:y 重构后生成的图像像数数值矩阵,
c=x;
h1=h/2;
for i=1:h1
y(2*i-1)=(c(i)+c(h1+i))/sqrt(2);
y(2*i)=(c(i)-c(h1+i))/sqrt(2);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -