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.

4 visualizzazioni (ultimi 30 giorni)
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]);

Risposta accettata

KALYAN ACHARJYA
KALYAN ACHARJYA il 5 Mar 2020
Modificato: KALYAN ACHARJYA il 5 Mar 2020
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 Commenti
Fauzia Yasmeen
Fauzia Yasmeen il 8 Mar 2020
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??

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Discrete Multiresolution Analysis in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by