dingfengfeng 发表于 2007-5-15 09:50

求各位大虾帮我看下这个小波程序

这个程序运行后不能显示三次小波分解图象,小弟怎么看也不知道错在哪?:'(
还有老师要我自己写三次小波重构图象,程序中只有1次重构图象,也跪求大虾们帮我想一下
明天就要交了,急啊:@Q :@Q
程序如下:
    %%**针对woman图像进行三次二维离散小波分解
clc
clear all
close all
load woman;
% X=imread('cameraman.tif');
% X=imread('miss01.bmp');
% X=im2double(X)*256;
figure(1);
imshow(X,);
title('原始图像');
axis square
=dwt2(X,'db2');
    %%各子带的行列数为原图像的一半+1,why?????
figure(2);
subplot(2,2,1);
imshow(cA1,);
title('db1低频系数图像');
axis square
subplot(2,2,2);
image(cH1);
title('db1水平高频图像');
axis square
subplot(2,2,3);
imshow(cV1,);
title('db1垂直高频图像');
axis square
subplot(2,2,4);
imshow(cD1,);
title('db1对角高频图像');
axis square
   %通过图像量化编码改善图像质量
nbcol=255;
% cod_X=wcodemat(X,nbcol);
cod_cA1=wcodemat(cA1,nbcol);
cod_cH1=wcodemat(cH1,nbcol);
cod_cV1=wcodemat(cV1,nbcol);
cod_cD1=wcodemat(cD1,nbcol);
dec2d=[...
    cod_cA1,cod_cH1;...
    cod_cV1,cod_cD1;...
    ];
%编码后的分解系数图像
figure(3);
subplot(2,2,1);
imshow(cod_cA1,);
title('db1编码后低频系数图像');
axis square
subplot(2,2,2);
imshow(cod_cH1,);
title('db1编码后水平高频图像');
axis square
subplot(2,2,3);
imshow(cod_cV1,);
title('db1编码后垂直高频图像');
axis square
subplot(2,2,4);
imshow(cod_cD1,);
title('db1编码后对角高频图像');
axis square
%%display the one time discomposition images on a single figure
c1=[cod_cA1(1:128,1:128),cod_cH1(1:128,1:128);...
    cod_cV1(1:128,1:128),cod_cD1(1:128,1:128)];
figure
imshow(c1,);
title('一次小波分解图像');
%% Two times discomposition
=dwt2(cod_cA1(1:128,1:128),'db2');
cod_ccA1=wcodemat(ccA1,nbcol);
cod_ccH1=wcodemat(ccH1,nbcol);
cod_ccV1=wcodemat(ccV1,nbcol);
cod_ccD1=wcodemat(ccD1,nbcol);
%%display the two times discomposition images on a single figure
cc1=[cod_ccA1(1:64,1:64),cod_ccH1(1:64,1:64);...
    cod_ccV1(1:64,1:64),cod_ccD1(1:64,1:64)];
c1=[cc1,cod_cH1(1:128,1:128);...
    cod_cV1(1:128,1:128),cod_cD1(1:128,1:128)];
figure
imshow(c1,)
title('二次小波分解图像');
%% Three times discomposition
=dwt2(cod_ccA1(1:64,1:64),'db2');
cod_cccA1=wcodemat(cccA1,nbcol);
cod_cccH1=wcodemat(cccH1,nbcol);
cod_cccV1=wcodemat(cccV1,nbcol);
cod_cccD1=wcodemat(cccD1,nbcol);
%%display the three times discomposition images on a single figure
ccc1=[cod_cccA1(1:32,1:32),cod_cccH1(1:32,1:32);...
    cod_cccV1(1:32,1:32),cod_cccD1(1:32,1:32)];
cc1=[ccc1,cod_ccH1(1:64,1:64);...
    cod_ccV1(1:64,1:64),cod_ccD1(1:64,1:64)];
c1=[cc1,cod_cH1(1:128,1:128);...
    cod_cV1(1:128,1:128),cod_cD1(1:128,1:128)];
figure
imshow(c1,)
title('三次小波分解图像');
% 一次逆小波变换,截去75%的小波系数???2007.4.22--------ok
cod_dH1(1:129,1:129)=0;
cod_dV1(1:129,1:129)=0;
cod_dD1(1:129,1:129)=0;
Y=idwt2(cod_cA1,cod_dH1,cod_dV1,cod_dD1,'db2');
Y=idwt2(cA1,cod_dH1,cod_dV1,cod_dD1,'db2');
imshow(Y,);
title('一次小波重构图像');

error=abs(Y-X); % 重构图形与原始图像误值
figure;
mesh(error); % 误差三维图像
title('absolute error display');

dingfengfeng 发表于 2007-5-15 10:43

怎么没人回呢?真的很急啊:@(
有没人知道哪有"基于小波变换的图象压缩编码"的论文?

zhangnan3509 发表于 2007-5-15 10:46

回复 #2 dingfengfeng 的帖子

青岛远洋船员学院学报 1997/03 中国学术期刊全文数据库

[ 本帖最后由 zhangnan3509 于 2007-5-15 10:59 编辑 ]

dingfengfeng 发表于 2007-5-15 13:22

谢谢3楼的.
没人能改上面的程序吗?:'(
页: [1]
查看完整版本: 求各位大虾帮我看下这个小波程序