Can anyone help me to solve my last line matlab error? When I use haar transfrom, it works perfect, but when I use db2, the last figure could not come, please help.

1 回表示 (過去 30 日間)
clear all; close all;
a=imread('fauzia.jpg');
x=imresize(a,[1024 1024]);
[xar,xhr,xvr,xdr]=dwt2(x(:,:,1),'db2');
[xag,xhg,xvg,xdg]=dwt2(x(:,:,2),'db2');
[xab,xhb,xvb,xdb]=dwt2(x(:,:,3),'db2');
xa(:,:,1)=xar;xa(:,:,2)=xag;xa(:,:,3)=xab;
xh(:,:,1)=xhr;xh(:,:,2)=xhg;xh(:,:,3)=xhb;
xv(:,:,1)=xvr;xv(:,:,2)=xvg;xv(:,:,3)=xvb;
xd(:,:,1)=xdr;xd(:,:,2)=xdg;xd(:,:,3)=xdb;
figure,imshow(xa/255);
figure,imshow(xh);
figure,imshow(xv);
figure,imshow(xd);
x1=[xa*0.003 log10(xv)*0.3;log10(xh)*0.3 log10(xd)*0.3];
figure;imshow(x1)
[xaar,xhhr,xvvr,xddr]=dwt2(xa(:,:,1),'db2');
[xaag,xhhg,xvvg,xddg]=dwt2(xa(:,:,2),'db2');
[xaab,xhhb,xvvb,xddb]=dwt2(xa(:,:,3),'db2');
xaa(:,:,1)=xaar;xaa(:,:,2)=xaag;xaa(:,:,3)=xaab;
xhh(:,:,1)=xhhr;xhh(:,:,2)=xhhg;xhh(:,:,3)=xhhb;
xvv(:,:,1)=xvvr;xvv(:,:,2)=xvvg;xvv(:,:,3)=xvvb;
xdd(:,:,1)=xddr;xdd(:,:,2)=xddg;xdd(:,:,3)=xddb;
figure,imshow(xaa/255);
figure,imshow(xhh);
figure,imshow(xvv);
figure,imshow(xdd);
x11=[xaa*0.001 log10(xvv)*0.3;log10(xhh)*0.3 log10(xdd)*0.3];
figure;imshow(x11)
[r,c,s] = size(xv);
figure;imshow([x11(1:r,1:c,:) xv*0.05; xh*0.05 xd*0.05])
[xaaar,xhhhr,xvvvr,xdddr]=dwt2(xaa(:,:,1),'db2');
[xaaag,xhhhg,xvvvg,xdddg]=dwt2(xaa(:,:,2),'db2');
[xaaab,xhhhb,xvvvb,xdddb]=dwt2(xaa(:,:,3),'db2');
xaaa(:,:,1)=xaaar;xaaa(:,:,2)=xaaag;xaaa(:,:,3)=xaaab;
xhhh(:,:,1)=xhhhr;xhhh(:,:,2)=xhhhg;xhhh(:,:,3)=xhhhb;
xvvv(:,:,1)=xvvvr;xvvv(:,:,2)=xvvvg;xvvv(:,:,3)=xvvvb;
xddd(:,:,1)=xdddr;xddd(:,:,2)=xdddg;xddd(:,:,3)=xdddb;
figure,imshow(xaaa/255);
figure,imshow(xhhh);
figure,imshow(xvvv);
figure,imshow(xddd);
x111=[xaaa*0.001 log10(xvvv)*0.3;log10(xhhh)*0.3 log10(xddd)*0.3];
figure,imshow(x111);
[r,c,s] = size(xvv);
figure;imshow([[x111(1:r,1:c,:) xvv*0.05; xhh*0.05 xdd*0.05] xv*0.05; xh*0.05 xd*0.05]);

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 3 月 5 日
編集済み: KALYAN ACHARJYA 2020 年 3 月 5 日
It's the issue with concanatation (Dimention Mismatch) , Here I have choosen one test image to check. Lets simply to get the issue
a2=xvv*0.05; %258x258x3
a3=xhh*0.05; %258x258x3
a4=xdd*0.05; %258x258x3
a5=xv*0.05; %258x258x3
a6=xh*0.05; %258x258x3
a7=xd*0.05; %258x258x3
a=[a1 a2; a3 a4]; %516x516x3
result=[a a5;a6 a7];
See the dimention mismatch with a, hence it shows the error, pleasse do modify, so that concanatation works
  2 件のコメント
Fauzia Yasmeen
Fauzia Yasmeen 2020 年 3 月 8 日
yes its the issue with concatenation as the error said that. what you suggested, i have a question
a2=xvv*0.05; %258x258x3
a3=xhh*0.05; %258x258x3
a4=xdd*0.05; %258x258x3
a5=xv*0.05; %258x258x3
a6=xh*0.05; %258x258x3
a7=xd*0.05; %258x258x3
a=[a1 a2; a3 a4]; %516x516x3
result=[a a5;a6 a7];
In the above code, a5, a6 and a7 is the 1 level dwt and we get 258*258*3, ok
But if we again apply dwt on a1, then a2, a3 and a4 should be 128*128*3???
I have done 3 level DWT, if i use haar instead of db2, the last line code works, but in db2, it didnt work.could you please recheck??
Fauzia Yasmeen
Fauzia Yasmeen 2020 年 3 月 8 日
could you please run my whole code and help me to solve the issue?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete Multiresolution Analysis についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by