0

I want to make haar wavelet transform of an image. I use this code, but the result is too bad. Can you help me?

[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
  • What do you expect to happen? Did you run the code? As it is now this code produces no output. – flawr Jun 11 '17 at 14:57
  • This code throws an error, could it be that you want `flowers` instead of `A` in the first line? – flawr Jun 11 '17 at 18:30
  • May be it throws an error because you don't have the image. And also I think the main problem is that when I try to upload a .bmp image, there is no map. Because of that I use [A,map] – Ксения Цочева Jun 12 '17 at 04:39
  • I did change the image source to one I have, how do you expect the variable `flowers` to be defined then? – flawr Jun 12 '17 at 09:09

0 Answers0