我想对图像进行haar小波变换。 我使用这段代码,结果太糟糕了。你能帮助我吗?
[A,map]=imread('flowers.bmp');
image(flowers);colormap(map);
[ca,ch,cv,cd]=dwt2(flowers,'haar');
a=upcoef2('a',ca,'haar',1);
h=upcoef2('h',ch,'haar',1);
v=upcoef2('v',cv,'haar',1);
d=upcoef2('d',cd,'haar',1);
[c,s]=wavedec2(flowers,1,'haar');
[ch,cv,cd]=detcoef2('all',c,s,1);
h=wrcoef2('h',c,s,'haar',1);
v=wrcoef2('v',c,s,'haar',1);
d=wrcoef2('d',c,s,'haar',1);
x0=waverec2(c,s,'haar');
[thr,sorh,keepapp]=ddencmp('cmp','wv',flowers);
[flowerscomp,CXC,LXC,PERF0,PERFL2]=
wdencmp('gbl',c,s,'haar',1,thr,sorh,keepapp);
colormap(map);
subplot(1,2,1);image(flowers);title('Original image');
axis square
subplot(1,2,2);image(flowerscomp);title('Compresed Image');
axis square