├── Data ├── Function ├── BDSD.m ├── ConvC.m ├── HySure.m ├── MTF_GLP_HPM.m ├── PPlus_s.m ├── RFUSE_TV.m ├── createHS.m ├── createMS.m ├── createPan.m ├── diffch.m ├── diffchT.m ├── diffcv.m ├── diffcvT.m ├── interp23tap.m ├── kernel2mat.m ├── multibands_Landsat.m ├── norm_blocco.m ├── onion_mult.m ├── onion_mult2D.m ├── onions_quality.m ├── proposed.m ├── q2nf.m ├── qual_assess.m ├── soft.m ├── sunsal.m └── vec_soft_col_iso.m ├── LICENSE ├── Pan_HS.m ├── Pan_MS_HS.m ├── Pan_MS__HS.m ├── Pan__MS_HS.m └── README.md /Data: -------------------------------------------------------------------------------- 1 | https://drive.google.com/drive/folders/0Bx1Xt1FLPEHfZjYxalR5S01YdXM 2 | -------------------------------------------------------------------------------- /Function/BDSD.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Reza219/Multiple-multiband-image-fusion/0a4a1f8964d8e3f9f8a2c6f2b8808be450db8ab5/Function/BDSD.m -------------------------------------------------------------------------------- /Function/ConvC.m: -------------------------------------------------------------------------------- 1 | function [A] = ConvC(X,FK,nr) 2 | %ConvC - defines a circular convolution (the same for all bands) accepting 3 | % a matrix and returnig a matrix. FK is the fft2 of a one-band filter 4 | 5 | [Ns,Np]=size(X); 6 | nc = Np/nr; 7 | A = reshape(real(ifft2(fft2(reshape(X',[nr,nc,Ns])).*repmat(FK,[1,1,Ns]))),nr*nc,Ns)'; -------------------------------------------------------------------------------- /Function/HySure.m: -------------------------------------------------------------------------------- 1 | function [X3,A2,time] = HySure(H2,M2,E,RE,K,alpha,beta,mu,ni,ratio,... 2 | nr,nc,nrr,ncc,Np,Ns,Ne) 3 | %% HySure 4 | tic 5 | 6 | dh = zeros(nr,nc); dh(1,1) = 1; dh(1,nc) = -1; 7 | dv = zeros(nr,nc); dv(1,1) = 1; dv(nr,1) = -1; 8 | FDH = fft2(dh); FDHC = conj(FDH); 9 | FDV = fft2(dv); FDVC = conj(FDV); 10 | 11 | B=kernel2mat(K,nr,nc); 12 | FB = fft2(B); FBC = conj(FB); 13 | 14 | denom=abs(FB.^2)+abs(FDH).^2+abs(FDV).^2+1; 15 | IBD_B = FBC ./denom; 16 | IBD_II = 1 ./denom; 17 | IBD_DH = FDHC./denom; 18 | IBD_DV = FDVC./denom; 19 | 20 | mask = zeros(nr, nc); 21 | mask(1:ratio:nr, 1:ratio:nc) = 1; 22 | maskim = repmat(mask, [1, 1, Ne]); 23 | mask = reshape(maskim,[nr*nc,Ne])'; 24 | 25 | H3ST=zeros(nr,nc,Ns); 26 | H3ST(1:ratio:end,1:ratio:end,:)=reshape(H2',[nrr,ncc,Ns]); 27 | H2ST = reshape(H3ST,[nr*nc,Ns])'; 28 | IE = E'*E+mu*eye(Ne); 29 | yyh = E'*H2ST; 30 | IRE = alpha*(RE'*RE)+mu*eye(Ne); 31 | yym = RE'*M2; 32 | 33 | % initialization 34 | V1=sunsal(E,H2,'lambda',2e-4,'ADDONE','yes','POSITIVITY','yes',... 35 | 'AL_iters',200,'TOL',1e-4,'verbose','no'); 36 | [xp,yp,zp]=meshgrid(1:ratio:nc,1:ratio:nr,1:Ne); 37 | [xq,yq,zq]=meshgrid(1:nc,1:nr,1:Ne); 38 | V1i3=interp3(xp,yp,zp,reshape(V1',[nrr,ncc,Ne]),xq,yq,zq,'*spline');%'linear' 39 | clear xp yp zp xq yq zq 40 | V1=reshape(V1i3,[Np,Ne])'; 41 | 42 | V2=V1; V3=V1; V4=V1; 43 | G1=zeros(Ne,nr*nc); G2=zeros(Ne,nr*nc); G3=zeros(Ne,nr*nc); G4=zeros(Ne,nr*nc); 44 | 45 | for ii=1:ni 46 | A2 = ConvC(V1+G1, IBD_B, nr) + ConvC(V2+G2, IBD_II, nr) + ... 47 | ConvC(V3+G3, IBD_DH, nr) + ConvC(V4+G4, IBD_DV, nr); 48 | NU1 = ConvC(A2, FB, nr) - G1; 49 | V1 = IE\(yyh + mu*NU1).*mask + NU1.*(1-mask); 50 | NU2 = A2 - G2; 51 | V2 = IRE\(alpha*yym + mu*NU2); 52 | NU3 = ConvC(A2, FDH, nr) - G3; 53 | NU4 = ConvC(A2, FDV, nr) - G4; 54 | [V3,V4] = vec_soft_col_iso(NU3,NU4,beta/mu); 55 | G1 = -NU1 + V1; % D1 - (XB - V1) 56 | G2 = -NU2 + V2; % D2 - (XDH - V2) 57 | G3 = -NU3 + V3; % D3 - (XDV - V3) 58 | G4 = -NU4 + V4; % D3 - (XDV - V3) 59 | end 60 | 61 | X3=reshape((E*A2)',[nr,nc,Ns]); 62 | X3(X3>1)=1; 63 | X3(X3<0)=0; 64 | 65 | time=toc; -------------------------------------------------------------------------------- /Function/MTF_GLP_HPM.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Reza219/Multiple-multiband-image-fusion/0a4a1f8964d8e3f9f8a2c6f2b8808be450db8ab5/Function/MTF_GLP_HPM.m -------------------------------------------------------------------------------- /Function/PPlus_s.m: -------------------------------------------------------------------------------- 1 | function [Y]=PPlus_s(X,n_dr,n_dc) 2 | % when input is 3 | % X=[X11 X12 X13 X14; 4 | % X21 X22 X23 X24; 5 | % X31 X32 X33 X34; 6 | % X41 X42 X43 X44] 7 | % the output is 8 | % X=[\sum_{i,j}X_{i,j} X12 X13 X14; 9 | % X21 X22 X23 X24; 10 | % X31 X32 X33 X34; 11 | % X41 X42 X43 X44] 12 | 13 | [nr,nc,nb]=size(X); 14 | 15 | %% Sum according to the column 16 | Temp=reshape(X,[nr*n_dc nc/n_dc nb]); 17 | Temp(:,1,:)=sum(Temp,2); 18 | 19 | %% Sum according to the row 20 | Temp1=reshape(permute(reshape(Temp(:,1,:),[nr n_dc nb]),[2 1 3]),[n_dc*n_dr nr/n_dr nb]); 21 | Y=permute(reshape(sum(Temp1,2),[n_dc n_dr nb]),[2 1 3]); 22 | 23 | end 24 | -------------------------------------------------------------------------------- /Function/RFUSE_TV.m: -------------------------------------------------------------------------------- 1 | function [X3,A2,time] = RFUSE_TV(H2,M2,E,RE,K,beta,mu,ni,... 2 | ratio,nr,nc,nrr,ncc,Np,Ns,Ne) 3 | %% RFUSE 4 | tic 5 | 6 | dh = zeros(nr,nc); dh(1,1) = 1; dh(1,nc) = -1; 7 | dv = zeros(nr,nc); dv(1,1) = 1; dv(nr,1) = -1; 8 | FDH = fft2(dh); FDHC = conj(FDH); 9 | FDV = fft2(dv); FDVC = conj(FDV); 10 | 11 | B=kernel2mat(K,nr,nc); 12 | BF = fft2(B); 13 | BF3 =repmat(BF,[1,1,Ne]); 14 | BF3c=repmat(conj(BF),[1,1,Ne]); 15 | B2Sum=PPlus_s(abs(BF3).^2./(ratio^2),nrr,ncc); 16 | 17 | denom=abs(FDH).^2+abs(FDV).^2+1; 18 | IBD_II = 1 ./denom; 19 | IBD_DH = FDHC./denom; 20 | IBD_DV = FDVC./denom; 21 | 22 | H3ST=zeros(nr,nc,Ns); 23 | H3ST(1:ratio:end,1:ratio:end,:)=reshape(H2',[nrr,ncc,Ns]); 24 | H2ST=reshape(H3ST,[nr*nc,Ns])'; 25 | ETE=E'*E; 26 | [Q,Lambda]=eig(ETE\(RE'*RE+mu*eye(Ne))); 27 | Lambda=reshape(diag(Lambda),[1,1,Ne]); 28 | C4=(ETE*Q)^-1; 29 | Cc=mu*C4; 30 | InvDI=1./(B2Sum+repmat(Lambda,[nrr,ncc,1])); 31 | InvLbd=1./repmat(Lambda,[nr,nc,1]); 32 | C3Cons=fft2(reshape((C4*(E'*H2ST))',[nr,nc,Ne])).*BF3c+... 33 | fft2(reshape((C4*(RE'*M2))',[nr,nc,Ne])); 34 | C3Cons=C3Cons.*InvLbd; 35 | 36 | % initialization 37 | A2=sunsal(E,H2,'lambda',2e-4,'ADDONE','yes','POSITIVITY','yes',... 38 | 'AL_iters',200,'TOL',1e-4,'verbose','no'); 39 | [xp,yp,zp]=meshgrid(1:ratio:nc,1:ratio:nr,1:Ne); 40 | [xq,yq,zq]=meshgrid(1:nc,1:nr,1:Ne); 41 | A3i=interp3(xp,yp,zp,reshape(A2',[nrr,ncc,Ne]),xq,yq,zq,'*spline');%'linear' 42 | clear xp yp zp xq yq zq 43 | A2=reshape(A3i,[Np,Ne])'; 44 | 45 | V2=A2; V3=A2; V4=A2; 46 | G2=zeros(Ne,nr*nc); G3=zeros(Ne,nr*nc); G4=zeros(Ne,nr*nc); 47 | 48 | for ii=1:ni 49 | A2=ConvC(V2+G2,IBD_II,nr)+ConvC(V3+G3,IBD_DH,nr)+ConvC(V4+G4,IBD_DV,nr); 50 | NU2=A2-G2; 51 | 52 | VpG=reshape(fft2(reshape((A2-G2)',[nr,nc,Ne])),[nr*nc,Ne])'; 53 | C3bar=C3Cons+reshape((Cc*VpG)',[nr,nc,Ne]).*InvLbd; 54 | temp=PPlus_s(C3bar/(ratio^2).*BF3,nrr,ncc); 55 | invQUF=C3bar-repmat(temp.*InvDI,[ratio ratio 1]).*BF3c; 56 | V2F=Q*reshape(invQUF,[nr*nc,Ne])'; 57 | V2=reshape(real(ifft2(reshape(V2F',[nr,nc,Ne]))),[nr*nc,Ne])'; 58 | 59 | NU3=ConvC(A2,FDH,nr)-G3; 60 | NU4=ConvC(A2,FDV,nr)-G4; 61 | [V3,V4]=vec_soft_col_iso(NU3,NU4,beta/mu); 62 | G2=-NU2+V2; % G2 - (X - V2) 63 | G3=-NU3+V3; % G3 - (XDh - V3) 64 | G4=-NU4+V4; % G4 - (XDv - V4) 65 | end 66 | 67 | % Postprocessing 68 | X3=reshape((E*A2)',[nr,nc,Ns]); 69 | X3(X3>1)=1; 70 | X3(X3<0)=0; 71 | 72 | time=toc; -------------------------------------------------------------------------------- /Function/createHS.m: -------------------------------------------------------------------------------- 1 | function [H3,H2,nrh,nch,Sh] = createHS(I3,rh,Kh,nr,nc,Ns,Noh,snrh) 2 | % creates hyperspectral image 3 | 4 | nrh=ceil(nr/rh); %number of rows 5 | nch=ceil(nc/rh); %number of columns 6 | H3=imfilter(I3,Kh,'circular'); 7 | H3=H3(1:rh:end,1:rh:end,:); 8 | Sh=zeros(Ns,1); 9 | for ii=1:Ns 10 | Sh(ii,1)=norm(H3(:,:,ii),'fro')^2/(nrh*nch)/10^(snrh/10); 11 | H3(:,:,ii)=H3(:,:,ii)+sqrt(Sh(ii,1))*Noh(:,:,ii); 12 | end 13 | H3(H3>1)=1; %%%%%%%%%% 14 | H3(H3<0)=0; %%%%%%%%%% 15 | H2=reshape(H3,[nrh*nch,Ns])'; 16 | 17 | end 18 | 19 | -------------------------------------------------------------------------------- /Function/createMS.m: -------------------------------------------------------------------------------- 1 | function [M3,M2,nrm,ncm,Sm] = createMS(I3,rm,Km,nr,nc,Ns,R,Nm,Nom,snrm) 2 | % creates multispectral image 3 | 4 | nrm=ceil(nr/rm); %number of rows 5 | ncm=ceil(nc/rm); %number of columns 6 | M3=imfilter(I3,Km,'circular'); 7 | M3=M3(1:rm:end,1:rm:end,:); 8 | M2=reshape(M3,[nrm*ncm,Ns])'; 9 | M2=R*M2; 10 | M3=reshape(M2',[nrm,ncm,Nm]); 11 | Sm=zeros(Nm,1); 12 | for ii=1:Nm 13 | Sm(ii,1)=norm(M3(:,:,ii),'fro')^2/(nrm*ncm)/10^(snrm/10); 14 | M3(:,:,ii)=M3(:,:,ii)+sqrt(Sm(ii,1))*Nom(:,:,ii); 15 | end 16 | M3(M3>1)=1; %%%%%%%%%% 17 | M3(M3<0)=0; %%%%%%%%%% 18 | M2=reshape(M3,[nrm*ncm,Nm])'; 19 | 20 | end 21 | 22 | -------------------------------------------------------------------------------- /Function/createPan.m: -------------------------------------------------------------------------------- 1 | function [p3,p2,sp] = createPan(I2,nr,nc,c,nop,snrp) 2 | % creates panchromatic image 3 | 4 | p2=c*I2; 5 | sp=mean(p2.^2)/10^(snrp/10); 6 | p2=p2+sqrt(sp)*nop; 7 | p2(p2>1)=1; %%%%%%%%%% 8 | p2(p2<0)=0; %%%%%%%%%% 9 | p3=reshape(p2,[nr,nc]); 10 | 11 | end 12 | 13 | -------------------------------------------------------------------------------- /Function/diffch.m: -------------------------------------------------------------------------------- 1 | function XD=diffch(X2,nr,nc,Np,Ne) 2 | 3 | X3=reshape(X2',[nr,nc,Ne]); 4 | XD=diff(X3,1,2); 5 | XD=cat(2,XD,X3(:,1,:)-X3(:,end,:)); 6 | XD=reshape(XD,[Np,Ne])'; 7 | 8 | end 9 | 10 | -------------------------------------------------------------------------------- /Function/diffchT.m: -------------------------------------------------------------------------------- 1 | function XD=diffchT(X,nr,nc,N,K) 2 | % circular horizontal gradient 3 | 4 | X=reshape(X',[nr,nc,K]); 5 | XD=diff(X,1,2); 6 | XD=cat(2,X(:,1,:)-X(:,end,:),XD); 7 | XD=-reshape(XD,[N,K])'; 8 | 9 | end -------------------------------------------------------------------------------- /Function/diffcv.m: -------------------------------------------------------------------------------- 1 | function XD=diffcv(X2,nr,nc,Np,Ne) 2 | 3 | X3=reshape(X2',[nr,nc,Ne]); 4 | XD=diff(X3); 5 | XD=cat(1,XD,X3(1,:,:)-X3(end,:,:)); 6 | XD=reshape(XD,[Np,Ne])'; 7 | 8 | end 9 | 10 | -------------------------------------------------------------------------------- /Function/diffcvT.m: -------------------------------------------------------------------------------- 1 | function XD=diffcvT(X2,nr,nc,N,K) 2 | % circular vertical gradient 3 | 4 | X3=reshape(X2',[nr,nc,K]); 5 | XD=diff(X3); 6 | XD=cat(1,X3(1,:,:)-X3(end,:,:),XD); 7 | XD=-reshape(XD,[N,K])'; 8 | 9 | end 10 | 11 | -------------------------------------------------------------------------------- /Function/interp23tap.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Reza219/Multiple-multiband-image-fusion/0a4a1f8964d8e3f9f8a2c6f2b8808be450db8ab5/Function/interp23tap.m -------------------------------------------------------------------------------- /Function/kernel2mat.m: -------------------------------------------------------------------------------- 1 | function B=kernel2mat(K,nr,nc) 2 | 3 | % flip the kernel 4 | K=rot90(K,2); 5 | mc=round((nc+1)/2); 6 | mr=round((nr+1)/2); 7 | 8 | % the size of the kernel 9 | [kh,kv]=size(K); 10 | lx=(kh-1)/2; 11 | ly=(kv-1)/2; 12 | B=zeros(nr,nc); 13 | 14 | % range of the pixels 15 | B(mr-lx:mr+lx,mc-ly:mc+ly)=K; 16 | B=circshift(B,[-mr+1,-mc+1]); -------------------------------------------------------------------------------- /Function/multibands_Landsat.m: -------------------------------------------------------------------------------- 1 | function B=multibands_Landsat(wave) 2 | 3 | %band 1, coastal aerosol 4 | a1=427:459; 5 | b1=[0.000073;0.000609;0.001628;0.003421;0.008019;0.024767;0.085688; 6 | 0.254149;0.517821;0.765117;0.908749;0.958204;0.977393;0.98379; 7 | 0.989052;0.986713;0.993683;0.993137;1;0.996969;0.98278;0.972692; 8 | 0.905808;0.745606;0.471329;0.226412;0.09286;0.036603;0.014537; 9 | 0.005829;0.002414;0.000984;0.000255]; 10 | 11 | %band 2, blue 12 | a2=436:527; 13 | b2=[0.00001;0.000061;0.000117;0.000241;0.000349;0.000455;0.000756; 14 | 0.001197;0.00207;0.003712;0.006869;0.013212;0.02717;0.058606;0.130876; 15 | 0.27137;0.493542;0.723971;0.85751;0.894222;0.903034;0.910928;0.90988; 16 | 0.899475;0.897977;0.889667;0.883542;0.877453;0.881011;0.874721; 17 | 0.879688;0.886569;0.891913;0.88768;0.861157;0.848533;0.840828; 18 | 0.828339;0.844202;0.865864;0.868497;0.890253;0.912538;0.910385; 19 | 0.918822;0.931726;0.931813;0.954248;0.955545;0.96242;0.956424; 20 | 0.953352;0.978564;0.989104;0.985615;0.989469;0.982262;0.968801; 21 | 0.967332;0.976836;0.988729;0.980826;0.967361;0.954754;0.964132; 22 | 0.966125;0.966772;0.981834;0.98232;0.965685;0.963135;0.972261; 23 | 0.996498;1;0.9556;0.844893;0.534592;0.190738;0.048329;0.013894; 24 | 0.005328;0.002611;0.001557;0.0011;0.000785;0.000516;0.000321; 25 | 0.000162;0.000072;0.000057;0.000023;0.000032]; 26 | 27 | %band 3, green 28 | a3=513:600; 29 | b3=[0.000016;0.00011;0.000247;0.000362;0.000648;0.000935;0.001332; 30 | 0.001816;0.002515;0.003446;0.00488;0.007024;0.010441;0.016247; 31 | 0.025513;0.041451;0.070551;0.123444;0.21168;0.353885;0.545856; 32 | 0.741205;0.865225;0.927396;0.954627;0.954163;0.959215;0.961328; 33 | 0.964902;0.969873;0.952489;0.961397;0.97827;0.977533;0.977001; 34 | 0.980884;0.990784;1;0.992264;0.982642;0.983832;0.977765;0.965081; 35 | 0.957314;0.946245;0.947871;0.959038;0.966534;0.977656;0.966447; 36 | 0.953399;0.958314;0.970039;0.978607;0.983397;0.98096;0.974522; 37 | 0.967229;0.979406;0.978208;0.975818;0.974392;0.979973;0.968827; 38 | 0.969181;0.967838;0.982956;0.979598;0.963811;0.968886;0.983655; 39 | 0.986657;0.974207;0.946407;0.904478;0.809275;0.684974;0.525304; 40 | 0.345364;0.190467;0.087833;0.035393;0.014077;0.005944;0.002574; 41 | 0.001046;0.000394;0.000085]; 42 | 43 | %band 4, red 44 | a4=626:682; 45 | b4=[0.00027;0.000895;0.00185;0.003648;0.007197;0.014515;0.030432; 46 | 0.066861;0.148518;0.299778;0.526812;0.764443;0.905473;0.947949; 47 | 0.950823;0.947418;0.951831;0.962705;0.975075;0.984173;0.983613; 48 | 0.983434;0.982911;0.973636;0.959441;0.955641;0.955548;0.953337; 49 | 0.956628;0.981688;1;0.992388;0.984615;0.981568;0.97696;0.97298; 50 | 0.98108;0.996804;0.992142;0.980678;0.964002;0.962154;0.970778; 51 | 0.96718;0.966928;0.949928;0.848855;0.609359;0.31635;0.123946; 52 | 0.046033;0.017702;0.007333;0.003205;0.001402;0.000554;0.000117]; 53 | 54 | %band 5, NIR 55 | a5=830:896; 56 | b5=[0.000011;0.00005;0.0001;0.000239;0.000314;0.000495;0.000719; 57 | 0.000986;0.001445;0.002107;0.00316;0.004744;0.007059;0.0109; 58 | 0.017346;0.028332;0.048191;0.084363;0.145365;0.249733;0.403526; 59 | 0.582623;0.745037;0.890315;0.960215;0.986833;0.973133;0.980606; 60 | 0.99612;1;0.989777;0.980733;0.975935;0.972043;0.957357;0.951209; 61 | 0.947044;0.953162;0.951499;0.94845;0.940094;0.950632;0.956079; 62 | 0.96646;0.969821;0.93661;0.891066;0.788733;0.63532;0.448364;0.288847; 63 | 0.174619;0.100343;0.058265;0.034532;0.02072;0.01244;0.007601; 64 | 0.004702;0.002944;0.00187;0.001192;0.000743;0.000423;0.000241; 65 | 0.000116;0.000044]; 66 | 67 | %band 6, pan 68 | a6=488:692; 69 | b6=[0.000216;0.000514;0.001013;0.001587;0.002619;0.003841;0.006195; 70 | 0.009003;0.015515;0.02327;0.042723;0.066556;0.124269;0.196006; 71 | 0.323232;0.472496;0.598302;0.714816;0.776009;0.816555;0.831881; 72 | 0.837994;0.848975;0.861668;0.862705;0.85964;0.858532;0.858244; 73 | 0.857148;0.855759;0.858455;0.862834;0.860609;0.855993;0.852785; 74 | 0.850183;0.852788;0.857317;0.85913;0.859876;0.861508;0.863494; 75 | 0.860265;0.855102;0.864423;0.879249;0.885593;0.888663;0.894758; 76 | 0.902017;0.906294;0.90929;0.911734;0.914;0.909776;0.902939;0.908919; 77 | 0.919859;0.92162;0.919456;0.91302;0.905134;0.892702;0.878599; 78 | 0.876838;0.879443;0.878303;0.875692;0.872666;0.869478;0.875361; 79 | 0.884759;0.889903;0.893427;0.885948;0.874097;0.875674;0.882402; 80 | 0.891375;0.901194;0.903528;0.902826;0.907551;0.91435;0.914932; 81 | 0.91319;0.915508;0.919554;0.920802;0.92104;0.924431;0.929105; 82 | 0.930068;0.929551;0.937549;0.948863;0.947084;0.940273;0.940813; 83 | 0.944136;0.945674;0.946566;0.942462;0.936298;0.939621;0.946659; 84 | 0.942374;0.933839;0.93425;0.93784;0.940838;0.943626;0.952415; 85 | 0.963664;0.967381;0.968241;0.968233;0.967878;0.965083;0.961367; 86 | 0.957232;0.952939;0.949345;0.946006;0.948081;0.952465;0.954526; 87 | 0.955814;0.959149;0.963216;0.964158;0.963953;0.965943;0.968789; 88 | 0.972688;0.977026;0.978028;0.977901;0.974158;0.969078;0.969583; 89 | 0.972297;0.972906;0.972708;0.969732;0.96578;0.965561;0.966835; 90 | 0.966641;0.965899;0.972067;0.981077;0.980971;0.977722;0.974405; 91 | 0.971123;0.963139;0.95326;0.953494;0.957536;0.963851;0.970928; 92 | 0.969453;0.96475;0.966541;0.970613;0.973941;0.977055;0.982894;0.98977; 93 | 0.988302;0.983542;0.987968;0.995538;0.998579;1;0.99981;0.999061; 94 | 0.997891;0.99658;0.992555;0.987369;0.985862;0.985761;0.955679;0.913945; 95 | 0.78014;0.610197;0.438556;0.266714;0.167313;0.094013;0.057564;0.034787; 96 | 0.022882;0.015178;0.010755;0.007663;0.005756;0.004292;0.00322;0.002283; 97 | 0.001545;0.000879;0.000214]; 98 | 99 | % %band 7, Cirrus 100 | % a7=1341:1402; 101 | % b7=[0.000086;0.000194;0.000321;0.000469;0.000647;0.000856;0.001119; 102 | % 0.001429;0.001828;0.002318;0.00303;0.004011;0.005398;0.007194;0.011124; 103 | % 0.016985;0.026321;0.042756;0.06922;0.115351;0.182833;0.316333;0.45703; 104 | % 0.596852;0.772118;0.862394;0.871575;0.930308;0.962664;0.931247; 105 | % 0.938676;0.983748;0.999626;0.986968;1;0.983239;0.990577;0.963584; 106 | % 0.964054;0.871343;0.872689;0.703198;0.606578;0.452434;0.29792;0.190978; 107 | % 0.113055;0.066174;0.041513;0.026084;0.016218;0.009774;0.006839; 108 | % 0.004358;0.00278;0.001809;0.001351;0.000887;0.000481;0.00022;0.000114; 109 | % 0.000029]; 110 | 111 | %band 8, SWIR1 112 | a8=1516:1696; 113 | b8=[0.000067;0.000151;0.000249;0.000348;0.000466;0.000585;0.000758; 114 | 0.000932;0.00115;0.001369;0.001613;0.001859;0.002172;0.002488;0.002881; 115 | 0.003277;0.003772;0.004271;0.004898;0.005528;0.006421;0.007319; 116 | 0.008459;0.009606;0.010989;0.012372;0.014303;0.016248;0.019029; 117 | 0.021831;0.02589;0.029952;0.035171;0.040434;0.047864;0.055352;0.065732; 118 | 0.076166;0.089024;0.101893;0.12015;0.138642;0.163127;0.187803;0.220261; 119 | 0.252894;0.291359;0.329939;0.375648;0.42147;0.47356;0.525681;0.578787; 120 | 0.631645;0.676683;0.721282;0.75477;0.788248;0.821155;0.854065;0.87337; 121 | 0.89183;0.899817;0.907252;0.913009;0.918685;0.922953;0.927163;0.92686; 122 | 0.926413;0.925059;0.923683;0.923953;0.924259;0.922828;0.921383;0.922061; 123 | 0.922756;0.924648;0.926605;0.934552;0.942525;0.944351;0.945872; 124 | 0.946175;0.946432;0.947006;0.947589;0.950194;0.952859;0.951303; 125 | 0.94967;0.953047;0.956494;0.959047;0.961545;0.960048;0.958335;0.959835; 126 | 0.96147;0.960857;0.960175;0.960813;0.961486;0.964703;0.967943;0.969314; 127 | 0.970589;0.973713;0.976906;0.9791;0.981258;0.981285;0.981372;0.988609; 128 | 0.995869;0.998021;1;0.999848;0.999642;0.99659;0.993439;0.986217; 129 | 0.978989;0.967125;0.95512;0.936199;0.917239;0.879424;0.840967;0.796545; 130 | 0.751893;0.694313;0.636542;0.573232;0.509946;0.451966;0.39403;0.34275; 131 | 0.291752;0.251309;0.211153;0.180823;0.15054;0.128463;0.106664;0.090735; 132 | 0.074941;0.06379;0.052752;0.045028;0.03731;0.031821;0.02635;0.022504; 133 | 0.018724;0.016045;0.013394;0.011483;0.009587;0.008227;0.006882;0.00591; 134 | 0.00494;0.004257;0.003576;0.003055;0.002541;0.00216;0.001781;0.001512; 135 | 0.001244;0.00104;0.000837;0.000677;0.000517;0.000409;0.000301;0.000206; 136 | 0.000112;0.00004]; 137 | 138 | %band 9, SWIR2 139 | a9=2038:2350; 140 | b9=[0.000037;0.000083;0.000131;0.000179;0.00024;0.000305;0.000368;0.00043; 141 | 0.000512;0.000599;0.000704;0.000814;0.000947;0.001085;0.001222;0.00136; 142 | 0.001546;0.001745;0.001964;0.002187;0.002439;0.002696;0.00301;0.003339; 143 | 0.003733;0.004141;0.004627;0.005137;0.005728;0.006337;0.007139; 144 | 0.007996;0.008903;0.009824;0.011005;0.012261;0.01361;0.014987;0.016872; 145 | 0.018899;0.021;0.023121;0.025897;0.028847;0.032071;0.035363;0.040206; 146 | 0.045432;0.050903;0.056429;0.06327;0.070409;0.079382;0.088907;0.10064; 147 | 0.11283;0.128292;0.144668;0.162055;0.179714;0.20278;0.227234;0.253732; 148 | 0.280925;0.311347;0.342526;0.377044;0.412621;0.45047;0.488816;0.522458; 149 | 0.554715;0.593227;0.633521;0.663067;0.689664;0.722284;0.756529;0.776463; 150 | 0.792667;0.813716;0.836001;0.846344;0.853714;0.867845;0.883615;0.886411; 151 | 0.886127;0.895232;0.906527;0.909739;0.911091;0.917985;0.926131;0.929693; 152 | 0.932227;0.936544;0.941406;0.942571;0.942952;0.943112;0.943194;0.945168; 153 | 0.947537;0.948776;0.949694;0.949643;0.9494;0.952551;0.956635;0.953083; 154 | 0.947423;0.949094;0.952773;0.950874;0.947477;0.947014;0.947085;0.951812; 155 | 0.957717;0.953332;0.946412;0.947778;0.951119;0.951641;0.951518; 156 | 0.948644;0.944956;0.942515;0.940311;0.9434;0.947923;0.94501;0.940213; 157 | 0.938737;0.93806;0.941859;0.947019;0.946554;0.944482;0.947414;0.951661; 158 | 0.949283;0.945318;0.939939;0.934142;0.935493;0.93882;0.939253;0.938955; 159 | 0.934675;0.929162;0.927085;0.925692;0.930508;0.936899;0.933908;0.927984; 160 | 0.930981;0.936472;0.935776;0.933523;0.935132;0.937592;0.946217;0.956567; 161 | 0.955661;0.951991;0.956666;0.963135;0.964442;0.964365;0.963523;0.962434; 162 | 0.962905;0.963685;0.962473;0.960741;0.959239;0.957814;0.957781;0.958041; 163 | 0.953274;0.94716;0.951706;0.958833;0.960212;0.960339;0.954785;0.947696; 164 | 0.951965;0.95906;0.960554;0.960764;0.95575;0.949261;0.953245;0.95997; 165 | 0.963736;0.966786;0.964315;0.960173;0.965473;0.973416;0.977637;0.980904; 166 | 0.98276;0.984155;0.984693;0.985056;0.991486;0.9996;0.997654;0.993153; 167 | 0.992469;0.992675;0.995894;1;0.999279;0.997261;0.994356;0.991127; 168 | 0.987747;0.984349;0.986037;0.989132;0.984536;0.978024;0.975019;0.972794; 169 | 0.974168;0.97654;0.976199;0.975206;0.974409;0.973662;0.967502;0.959895; 170 | 0.956943;0.955095;0.955085;0.955588;0.947195;0.93665;.922405;0.907109; 171 | 0.89494;0.883588;0.855489;0.823876;0.78488;0.744025;0.69852;0.651673; 172 | 0.602539;0.552647;0.502693;0.452698;0.403993;0.355569;.315712;0.27826; 173 | 0.244645;0.212213;0.186151;0.161749;0.141435;0.122015;0.106531; 174 | 0.092029;0.080268;0.069276;0.060703;0.052702;0.046332;0.040405;0.035634; 175 | 0.031213;0.027516;0.024;0.021262;0.018688;0.016562;0.014545;0.01293; 176 | 0.011426;0.010155;0.008959;0.007992;0.007088;0.006348;0.005643;0.005019; 177 | 0.004415;0.003903;0.003421;0.003025;0.002651;0.00234;0.002047;0.001795; 178 | 0.001554;0.001345;0.001145;0.000974;0.000811;0.00068;0.00056;0.00044; 179 | 0.00032;0.000217;0.000119;0.000028]; 180 | 181 | w=wave; 182 | [~,i1,j1]=intersect(w,a1); 183 | [~,i2,j2]=intersect(w,a2); 184 | [~,i3,j3]=intersect(w,a3); 185 | [~,i4,j4]=intersect(w,a4); 186 | [~,i5,j5]=intersect(w,a5); 187 | [~,i6,j6]=intersect(w,a6); 188 | %[~,i7,j7]=intersect(w,a7); 189 | [~,i8,j8]=intersect(w,a8); 190 | [~,i9,j9]=intersect(w,a9); 191 | 192 | B=zeros(6,length(w)); 193 | B(1,i1)=b1(j1); 194 | B(2,i2)=b2(j2); 195 | B(3,i3)=b3(j3); 196 | B(4,i4)=b4(j4); 197 | B(5,i5)=b5(j5); 198 | B(6,i6)=b6(j6); 199 | B(7,i8)=b8(j8); 200 | B(8,i9)=b9(j9); 201 | 202 | end -------------------------------------------------------------------------------- /Function/norm_blocco.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%% Q2n aux. function 2 | function [y,a,c] = norm_blocco(x) 3 | 4 | a=mean2(x); 5 | c=std2(x); 6 | 7 | if(c==0) 8 | c = eps; 9 | end 10 | 11 | y=((x-a)/c)+1; 12 | 13 | end -------------------------------------------------------------------------------- /Function/onion_mult.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%% Q2n aux. function 2 | function ris=onion_mult(onion1,onion2) 3 | 4 | N=length(onion1); 5 | 6 | if N>1 7 | 8 | L=N/2; 9 | 10 | a=onion1(1:L); 11 | b=onion1(L+1:end); 12 | b=[b(1),-b(2:end)]; 13 | c=onion2(1:L); 14 | d=onion2(L+1:end); 15 | d=[d(1),-d(2:end)]; 16 | 17 | 18 | if N==2 19 | ris=[a*c-d*b,a*d+c*b]; 20 | else 21 | ris1=onion_mult(a,c); 22 | ris2=onion_mult(d,[b(1),-b(2:end)]); %% 23 | ris3=onion_mult([a(1),-a(2:end)],d); %% 24 | ris4=onion_mult(c,b); 25 | 26 | aux1=ris1-ris2; 27 | aux2=ris3+ris4; 28 | 29 | ris=[aux1,aux2]; 30 | end 31 | 32 | else 33 | ris = onion1*onion2; 34 | end 35 | 36 | end -------------------------------------------------------------------------------- /Function/onion_mult2D.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%% Q2n aux. function 2 | function ris = onion_mult2D(onion1,onion2) 3 | 4 | [~,~,N3]=size(onion1); 5 | 6 | if N3>1 7 | 8 | L=N3/2; 9 | 10 | a=onion1(:,:,1:L); 11 | b=onion1(:,:,L+1:end); 12 | b=cat(3,b(:,:,1),-b(:,:,2:end)); 13 | c=onion2(:,:,1:L); 14 | d=onion2(:,:,L+1:end); 15 | d=cat(3,d(:,:,1),-d(:,:,2:end)); 16 | 17 | 18 | if N3==2 19 | ris=cat(3,a.*c-d.*b,a.*d+c.*b); 20 | else 21 | ris1=onion_mult2D(a,c); 22 | ris2=onion_mult2D(d,cat(3,b(:,:,1),-b(:,:,2:end))); 23 | ris3=onion_mult2D(cat(3,a(:,:,1),-a(:,:,2:end)),d); 24 | ris4=onion_mult2D(c,b); 25 | 26 | aux1=ris1-ris2; 27 | aux2=ris3+ris4; 28 | 29 | ris=cat(3,aux1,aux2); 30 | end 31 | 32 | else 33 | ris = onion1.*onion2; 34 | end 35 | 36 | end -------------------------------------------------------------------------------- /Function/onions_quality.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%% Q2n aux. function 2 | function q = onions_quality(dat1,dat2,size1) 3 | 4 | dat1=double(dat1); 5 | dat2=double(dat2); 6 | dat2=cat(3,dat2(:,:,1),-dat2(:,:,2:end)); 7 | [~,~,N3]=size(dat1); 8 | size2=size1; 9 | 10 | % Block normalization 11 | for i=1:N3 12 | [a1,s,t]=norm_blocco(squeeze(dat1(:,:,i))); 13 | dat1(:,:,i)=a1; 14 | clear a1 15 | if s==0 16 | if i==1 17 | dat2(:,:,i)=dat2(:,:,i)-s+1; 18 | else 19 | dat2(:,:,i)=-(-dat2(:,:,i)-s+1); 20 | end 21 | else 22 | if i==1 23 | dat2(:,:,i)=((dat2(:,:,i)-s)/t)+1; 24 | else 25 | dat2(:,:,i)=-(((-dat2(:,:,i)-s)/t)+1); 26 | end 27 | end 28 | end 29 | 30 | m1=zeros(1,N3); 31 | m2=zeros(1,N3); 32 | 33 | mod_q1m=0; 34 | mod_q2m=0; 35 | mod_q1=zeros(size1,size2); 36 | mod_q2=zeros(size1,size2); 37 | 38 | for i=1:N3 39 | m1(i)=mean2(squeeze(dat1(:,:,i))); 40 | m2(i)=mean2(squeeze(dat2(:,:,i))); 41 | mod_q1m=mod_q1m+(m1(i)^2); 42 | mod_q2m=mod_q2m+(m2(i)^2); 43 | mod_q1=mod_q1+((squeeze(dat1(:,:,i))).^2); 44 | mod_q2=mod_q2+((squeeze(dat2(:,:,i))).^2); 45 | end 46 | 47 | mod_q1m=sqrt(mod_q1m); 48 | mod_q2m=sqrt(mod_q2m); 49 | mod_q1=sqrt(mod_q1); 50 | mod_q2=sqrt(mod_q2); 51 | 52 | termine2 = (mod_q1m*mod_q2m); 53 | termine4 = ((mod_q1m^2)+(mod_q2m^2)); 54 | int1=(size1*size2)/((size1*size2)-1)*mean2(mod_q1.^2); 55 | int2=(size1*size2)/((size1*size2)-1)*mean2(mod_q2.^2); 56 | termine3=int1+int2-(size1*size2)/((size1*size2)-1)*((mod_q1m^2)+(mod_q2m^2)); 57 | 58 | mean_bias=2*termine2/termine4; 59 | if termine3==0 60 | q=zeros(1,1,N3); 61 | q(:,:,N3)=mean_bias; 62 | else 63 | cbm=2/termine3; 64 | qu=onion_mult2D(dat1,dat2); 65 | qm=onion_mult(m1,m2); 66 | qv=zeros(1,N3); 67 | for i=1:N3 68 | qv(i)=(size1*size2)/((size1*size2)-1)*mean2(squeeze(qu(:,:,i))); 69 | end 70 | q=qv-(size1*size2)/((size1*size2)-1)*qm; 71 | q=q*mean_bias*cbm; 72 | end 73 | 74 | end -------------------------------------------------------------------------------- /Function/proposed.m: -------------------------------------------------------------------------------- 1 | function [X3,A2,time] = proposed(H2,M2,p2,E,RE,cE,Kh,Km,Sh,Sm,sp,alpha,... 2 | mu,ni,ratioh,ratiom,nr,nc,nrh,nch,nrm,ncm,Np,Ns,Ne,Nm) 3 | %% HySure multi lambda (HS+MS+PAN) 4 | tic 5 | 6 | proj_simplex_array=@(y)max(bsxfun(@minus,y,max(bsxfun(@rdivide,... 7 | cumsum(sort(y,1,'descend'),1)-1,(1:size(y,1))'),[],1)),0); 8 | 9 | dh=zeros(nr,nc); dh(1,1)=-1; dh(1,nc)=1; 10 | dv=zeros(nr,nc); dv(1,1)=-1; dv(nr,1)=1; 11 | FDh=fft2(dh); 12 | FDv=fft2(dv); 13 | 14 | Bh=kernel2mat(Kh,nr,nc); 15 | Bm=kernel2mat(Km,nr,nc); 16 | FBh=fft2(Bh); 17 | FBm=fft2(Bm); 18 | 19 | denom=abs(FBh).^2+abs(FBm).^2+abs(FDh).^2+abs(FDv).^2+2; 20 | IBD_I =1 ./denom; 21 | 22 | Mh=zeros(nr,nc); %mask, Sh*ShT 23 | Mh(1:ratioh:nr,1:ratioh:nc)=1; 24 | Mh3=repmat(Mh,[1,1,Ne]); 25 | Mh=reshape(Mh3,[nr*nc,Ne])'; 26 | H3ST=zeros(nr,nc,Ns); 27 | H3ST(1:ratioh:end,1:ratioh:end,:)=reshape(H2',[nrh,nch,Ns]); 28 | HST=reshape(H3ST,[nr*nc,Ns])'; 29 | IEi=(E'*diag(1./Sh)*E+mu*eye(Ne))^-1; 30 | ETHST=E'*diag(1./Sh)*HST; 31 | 32 | Mm=zeros(nr,nc); %mask, Sm*SmT 33 | Mm(1:ratiom:nr,1:ratiom:nc)=1; 34 | Mm3=repmat(Mm,[1,1,Ne]); 35 | Mm=reshape(Mm3,[nr*nc,Ne])'; 36 | M3ST=zeros(nr,nc,Nm); 37 | M3ST(1:ratiom:end,1:ratiom:end,:)=reshape(M2',[nrm,ncm,Nm]); 38 | MST=reshape(M3ST,[nr*nc,Nm])'; 39 | IREi=((RE'*diag(1./Sm)*RE)+mu*eye(Ne))^-1; 40 | ETRTMST=RE'*diag(1./Sm)*MST; 41 | 42 | IrTEi=((cE'*cE)/sp+mu*eye(Ne))^-1; 43 | ETrp=(cE'*p2)/sp; 44 | 45 | % initialization 46 | U1=sunsal(E,H2,'lambda',2e-4,'ADDONE','yes','POSITIVITY','yes',... 47 | 'AL_iters',200,'TOL',1e-4,'verbose','no'); 48 | [xp,yp,zp]=meshgrid(1:ratioh:nc,1:ratioh:nr,1:Ne); 49 | [xq,yq,zq]=meshgrid(1:nc,1:nr,1:Ne); 50 | U1i3=interp3(xp,yp,zp,reshape(U1',[nrh,nch,Ne]),xq,yq,zq,'*spline');%'linear' 51 | clear xp yp zp xq yq zq 52 | U1=reshape(U1i3,[Np,Ne])'; 53 | 54 | U2=U1; U3=U1; V1=U1; V2=U1; W=U1; 55 | Gu1=zeros(Ne,nr*nc); Gu2=zeros(Ne,nr*nc); Gu3=zeros(Ne,nr*nc); 56 | Gw=zeros(Ne,nr*nc); Gv1=zeros(Ne,nr*nc); Gv2=zeros(Ne,nr*nc); 57 | 58 | for ii=1:ni 59 | A2=ConvC(reshape(imfilter(reshape((U1+Gu1)',[nr,nc,Ne]),Kh,'circular'),[Np,Ne])'+... 60 | reshape(imfilter(reshape((U2+Gu2)',[nr,nc,Ne]),Km,'circular'),[Np,Ne])'+... 61 | diffchT(V1+Gv1,nr,nc,Np,Ne)+diffcvT(V2+Gv2,nr,nc,Np,Ne)+... 62 | U3+Gu3+W+Gw,IBD_I,nr); 63 | Nu1=reshape(imfilter(reshape(A2',[nr,nc,Ne]),Kh,'circular'),[Np,Ne])'-Gu1; 64 | Nu2=reshape(imfilter(reshape(A2',[nr,nc,Ne]),Km,'circular'),[Np,Ne])'-Gu2; 65 | Nu3=A2-Gu3; 66 | Nw =A2-Gw; 67 | Nv1=diffch(A2,nr,nc,Np,Ne)-Gv1; 68 | Nv2=diffcv(A2,nr,nc,Np,Ne)-Gv2; 69 | U1=IEi *(ETHST +mu*Nu1.*Mh)+Nu1.*(1-Mh); 70 | U2=IREi *(ETRTMST+mu*Nu2.*Mm)+Nu2.*(1-Mm); 71 | U3=IrTEi*(ETrp +mu*Nu3); 72 | [V1,V2]=vec_soft_col_iso(Nv1,Nv2,alpha/mu); 73 | W=proj_simplex_array(Nw); 74 | Gu1=-Nu1+U1; % Gu1 - (ABh - U1) 75 | Gu2=-Nu2+U2; % Gu2 - (ABm - U2) 76 | Gu3=-Nu3+U3; % Gu3 - (A - U3) 77 | Gv1=-Nv1+V1; % Gv1 - (ADh - V1) 78 | Gv2=-Nv2+V2; % Gv2 - (ADv - V2) 79 | Gw =-Nw+W; % Gu4 - (A - U4) 80 | end 81 | 82 | X3=reshape((E*A2)',[nr,nc,Ns]); 83 | X3(X3>1)=1; 84 | X3(X3<0)=0; 85 | 86 | time=toc; -------------------------------------------------------------------------------- /Function/q2nf.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Reza219/Multiple-multiband-image-fusion/0a4a1f8964d8e3f9f8a2c6f2b8808be450db8ab5/Function/q2nf.m -------------------------------------------------------------------------------- /Function/qual_assess.m: -------------------------------------------------------------------------------- 1 | function [ergas,sam,q2n] = qual_assess(I3,X3,ratio,Ns,Np,Qbs) 2 | 3 | % ERGAS 4 | a=squeeze(sum(sum((X3-I3).^2,1),2))/Np; 5 | m=squeeze(sum(sum(I3,1),2))/Np; 6 | ergas=sqrt(sum(a./(m.^2))/Ns)*100/ratio; 7 | 8 | % SAM 9 | num=sum(X3.*I3,3); 10 | den=sqrt(sum(X3.^2,3).*sum(I3.^2,3)); 11 | sam=nanmean(acosd(num(:)./den(:))); 12 | 13 | %Q2n 14 | q2n=q2nf(I3,X3,Qbs); 15 | 16 | end -------------------------------------------------------------------------------- /Function/soft.m: -------------------------------------------------------------------------------- 1 | function y = soft(x,T) 2 | % y = soft(x,T) 3 | % soft-thresholding function, proximity operator for l1 norm 4 | 5 | if sum(abs(T(:)))==0 6 | y = x; 7 | else 8 | y = max(abs(x) - T, 0); 9 | y = y./(y+T) .* x; 10 | end 11 | -------------------------------------------------------------------------------- /Function/sunsal.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Reza219/Multiple-multiband-image-fusion/0a4a1f8964d8e3f9f8a2c6f2b8808be450db8ab5/Function/sunsal.m -------------------------------------------------------------------------------- /Function/vec_soft_col_iso.m: -------------------------------------------------------------------------------- 1 | function [Y1,Y2] = vec_soft_col_iso(X1,X2,t) 2 | % computes the isotropic vector soft columnwise 3 | 4 | n = sqrt(sum(X1.^2)+sum(X2.^2)); 5 | a = max(n-t,0); 6 | A = repmat((a./n),size(X1,1),1); 7 | Y1 = A.*X1; 8 | Y2 = A.*X2; 9 | 10 | end -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Pan_HS.m: -------------------------------------------------------------------------------- 1 | % Pan + HS 2 | 3 | clear 4 | addpath('function') 5 | 6 | load('Data\Botswana.mat') 7 | load('Noise\N_Botswana.mat') 8 | beta=6e-5; % regularization parameter 9 | ps=14:36; 10 | % load('Data\IndianPines.mat') 11 | % load('Noise\N_IndianPines.mat') 12 | % beta=7e-5; % regularization parameter 13 | % ps=10:30; 14 | % load('Data\DCMall.mat') 15 | % load('Noise\N_DCMall.mat') 16 | % beta=2.5e-4; % regularization parameter 17 | % ps=24:53; 18 | % load('Data\Moffett.mat') 19 | % load('Noise\N_Moffett.mat') 20 | % beta=8e-4; % regularization parameter 21 | % ps=14:36; 22 | % load('Data\KennedySpaceCenter.mat') 23 | % load('Noise\N_KennedySpaceCenter.mat') 24 | % beta=8e-4; % regularization parameter 25 | % ps=14:36; 26 | 27 | % paramaters 28 | ni =200; % number of iterations 29 | snrh=30; % HS SNR (dB) 30 | snrm=30; % MS SNR (dB) 31 | snrp=40; % pan SNR (dB) 32 | mu =.02; % penalty parameter 33 | 34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 35 | %% spectral responses 36 | R=multibands_Landsat(w); 37 | c=R(6,:); 38 | c=c/sum(c); 39 | cE=c*E; 40 | 41 | %% MTFs (blur kernels) 42 | Km =fspecial('gaussian',[3,3],.8); % MS spatial filter kernel 43 | rh =4; % HS spatial downsampling factor 44 | Kh =conv2(Km,Km); % HS spatial filter kernel 45 | 46 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 47 | %% synthesize images 48 | [~,p2,~] =createPan(I2,nr,nc,c,nop,snrp); % Pan 49 | [~,H2,nrh,nch,Sh]=createHS (I3,rh,Kh,nr,nc,Ns,Noh,snrh); % HS 50 | 51 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 52 | %% Pan+HS fusion 53 | [X3,~,time]=HySure(H2,p2,E,cE,Kh,1,beta,mu,ni,rh,nr,nc,nrh,nch,Np,Ns,Ne); 54 | %[X3,~,time]=RFUSE_TV(H2,p2,E,cE,Kh,beta,mu,ni,rh,nr,nc,nrh,nch,Np,Ns,Ne); 55 | 56 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 57 | %% results 58 | [ergas,sam,q2n]=qual_assess(I3(:,:,ps),X3(:,:,ps),rh,length(ps),Np,32); 59 | fprintf('\n spectrum of pan\n ERGAS = %2.3f\n SAM = %2.3f\n Q2n = %2.3f',... 60 | ergas,sam,q2n) 61 | 62 | [ergas,sam,q2n]=qual_assess(I3,X3,rh,Ns,Np,32); 63 | fprintf('\n entire spectrum\n ERGAS = %2.3f\n SAM = %2.3f\n Q2n = %2.3f\n time = %2.3f\n'... 64 | ,ergas,sam,q2n,time) 65 | 66 | nrmse=zeros(Np,1); 67 | X2p=reshape(X3(:,:,ps),[Np,length(ps)])'; 68 | I2p=reshape(I3(:,:,ps),[Np,length(ps)])'; 69 | for ii=1:Np 70 | nrmse(ii)=norm(X2p(:,ii)-I2p(:,ii))/norm(I2p(:,ii))*100; 71 | end 72 | figure, plot(sort(nrmse)), title('spectrum of pan') 73 | xlabel('pixel number'), ylabel('per-pixel NRMSE (%)') 74 | 75 | nrmse=zeros(Np,1); 76 | X2=reshape(X3,[Np,Ns])'; 77 | for ii=1:Np 78 | nrmse(ii)=norm(X2(:,ii)-I2(:,ii))/norm(I2(:,ii))*100; 79 | end 80 | figure, plot(sort(nrmse)), title('entire spectrum') 81 | xlabel('pixel number'), ylabel('per-pixel NRMSE (%)') 82 | -------------------------------------------------------------------------------- /Pan_MS_HS.m: -------------------------------------------------------------------------------- 1 | % Pan + MS + HS 2 | 3 | clear 4 | addpath('function') 5 | 6 | load('Data\Botswana.mat') 7 | load('Noise\N_Botswana.mat') 8 | alpha=10; %regularization parameter 9 | ps=14:36; 10 | % load('Data\IndianPines.mat') 11 | % load('Noise\N_IndianPines.mat') 12 | % alpha=9; %regularization parameter 13 | % ps=10:30; 14 | % load('Data\DCMall.mat') 15 | % load('Noise\N_DCMall.mat') 16 | % alpha=8; %regularization parameter 17 | % ps=24:53; 18 | % load('Data\Moffett.mat') 19 | % load('Noise\N_Moffett.mat') 20 | % alpha=20; %regularization parameter 21 | % ps=14:36; 22 | % load('Data\KennedySpaceCenter.mat') 23 | % load('Noise\N_KennedySpaceCenter.mat') 24 | % alpha=30; %regularization parameter 25 | % ps=14:36; 26 | 27 | % paramaters 28 | ni =200; % number of iterations 29 | snrh=30; % HS SNR (dB) 30 | snrm=30; % MS SNR (dB) 31 | snrp=40; % pan SNR (dB) 32 | mu =1.5e3; % penalty parameter 33 | 34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 35 | %% spectral responses 36 | Nm=7; % number of bands 37 | R=multibands_Landsat(w); 38 | c=R(6,:); 39 | c=c/sum(c); 40 | R(6,:)=[]; %%%%%%%%%%% 41 | R=R./(sum(R,2)*ones(1,Ns)); 42 | RE=R*E; 43 | cE=c*E; 44 | 45 | %% MTFs (blur kernels) 46 | rm =2; % MS spatial downsampling factor 47 | Km =fspecial('gaussian',[3,3],.8); % MS spatial filter kernel 48 | rh =4; % HS spatial downsampling factor 49 | Kh =conv2(Km,Km); % HS spatial filter kernel 50 | 51 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 52 | %% synthesize images 53 | [~,p2,sp] =createPan(I2,nr,nc,c,nop,snrp); % Pan 54 | [~,M2,nrm,ncm,Sm]=createMS (I3,rm,Km,nr,nc,Ns,R,Nm,Nom,snrm); % MS 55 | [~,H2,nrh,nch,Sh]=createHS (I3,rh,Kh,nr,nc,Ns,Noh,snrh); % HS 56 | 57 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 58 | %% Pan+MS+HS fusion 59 | [X3,~,time]=proposed(H2,M2,p2,E,RE,cE,Kh,Km,Sh,Sm,sp,alpha,mu,ni,... 60 | rh,rm,nr,nc,nrh,nch,nrm,ncm,Np,Ns,Ne,Nm); 61 | 62 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 63 | %% results 64 | [ergas,sam,q2n]=qual_assess(I3(:,:,ps),X3(:,:,ps),rh,length(ps),Np,32); 65 | fprintf('\n spectrum of pan\n ERGAS = %2.3f\n SAM = %2.3f\n Q2n = %2.3f',... 66 | ergas,sam,q2n) 67 | 68 | [ergas,sam,q2n]=qual_assess(I3,X3,rh,Ns,Np,32); 69 | fprintf('\n entire spectrum\n ERGAS = %2.3f\n SAM = %2.3f\n Q2n = %2.3f\n time = %2.3f\n'... 70 | ,ergas,sam,q2n,time) 71 | 72 | nrmse=zeros(Np,1); 73 | X2p=reshape(X3(:,:,ps),[Np,length(ps)])'; 74 | I2p=reshape(I3(:,:,ps),[Np,length(ps)])'; 75 | for ii=1:Np 76 | nrmse(ii)=norm(X2p(:,ii)-I2p(:,ii))/norm(I2p(:,ii))*100; 77 | end 78 | figure, plot(sort(nrmse)), title('spectrum of pan') 79 | xlabel('pixel number'), ylabel('per-pixel NRMSE (%)') 80 | 81 | nrmse=zeros(Np,1); 82 | X2=reshape(X3,[Np,Ns])'; 83 | for ii=1:Np 84 | nrmse(ii)=norm(X2(:,ii)-I2(:,ii))/norm(I2(:,ii))*100; 85 | end 86 | figure, plot(sort(nrmse)), title('entire spectrum') 87 | xlabel('pixel number'), ylabel('per-pixel NRMSE (%)') 88 | -------------------------------------------------------------------------------- /Pan_MS__HS.m: -------------------------------------------------------------------------------- 1 | % (Pan + MS) + HS 2 | 3 | clear 4 | addpath('function') 5 | 6 | load('Data\Botswana.mat') 7 | load('Noise\N_Botswana.mat') 8 | beta=2.2e-4; % regularization parameter 9 | ps=14:36; 10 | % load('Data\IndianPines.mat') 11 | % load('Noise\N_IndianPines.mat') 12 | % beta=2.7e-4; % regularization parameter 13 | % ps=10:30; 14 | % load('Data\DCMall.mat') 15 | % load('Noise\N_DCMall.mat') 16 | % beta=8e-4; % regularization parameter 17 | % ps=24:53; 18 | % load('Data\Moffett.mat') 19 | % load('Noise\N_Moffett.mat') 20 | % beta=1.4e-3; % regularization parameter 21 | % ps=14:36; 22 | % load('Data\KennedySpaceCenter.mat') 23 | % load('Noise\N_KennedySpaceCenter.mat') 24 | % beta=4e-3; % regularization parameter 25 | % ps=14:36; 26 | 27 | % paramaters 28 | ni =200; % number of iterations 29 | snrh=30; % HS SNR (dB) 30 | snrm=30; % MS SNR (dB) 31 | snrp=40; % pan SNR (dB) 32 | mu =.02; % penalty parameter 33 | 34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 35 | %% spectral responses 36 | Nm=7; % number of bands 37 | R=multibands_Landsat(w); 38 | c=R(6,:); 39 | c=c/sum(c); 40 | R(6,:)=[]; %%%%%%%%%%% 41 | R=R./(sum(R,2)*ones(1,Ns)); 42 | RE=R*E; 43 | cE=c*E; 44 | 45 | %% MTFs (blur kernels) 46 | rm =2; % MS spatial downsampling factor 47 | Km =fspecial('gaussian',[3,3],.8); % MS spatial filter kernel 48 | rh =4; % HS spatial downsampling factor 49 | Kh =conv2(Km,Km); % HS spatial filter kernel 50 | 51 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 52 | %% synthesize images 53 | [p3,~,sp] =createPan(I2,nr,nc,c,nop,snrp); % Pan 54 | [M3,~,nrm,ncm,Sm]=createMS (I3,rm,Km,nr,nc,Ns,R,Nm,Nom,snrm); % MS 55 | [~,H2,nrh,nch,Sh]=createHS (I3,rh,Kh,nr,nc,Ns,Noh,snrh); % HS 56 | 57 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 58 | %% fusion 59 | % Pan+MS 60 | [Y2,t1]=BDSD(p3,M3,bs,Np,Nm,Km,rm); 61 | %[Y2,t1]=MTF_GLP_HPM(p3,M3,Np,Nm,Km,rm); 62 | 63 | % (Pan+MS)+HS 64 | [X3,~,t2]=HySure(H2,Y2,E,RE,Kh,1,beta,mu,ni,rh,nr,nc,nrh,nch,Np,Ns,Ne); 65 | %[X3,~,t2]=RFUSE_TV(H2,Y2,E,RE,Kh,beta,mu,ni,rh,nr,nc,nrh,nch,Np,Ns,Ne); 66 | 67 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 68 | %% results 69 | [ergas,sam,q2n]=qual_assess(I3(:,:,ps),X3(:,:,ps),rh,length(ps),Np,32); 70 | fprintf('\n spectrum of pan\n ERGAS = %2.3f\n SAM = %2.3f\n Q2n = %2.3f',... 71 | ergas,sam,q2n) 72 | 73 | [ergas,sam,q2n]=qual_assess(I3,X3,rh,Ns,Np,32); 74 | fprintf('\n entire spectrum\n ERGAS = %2.3f\n SAM = %2.3f\n Q2n = %2.3f\n time = %2.3f\n'... 75 | ,ergas,sam,q2n,t1+t2) 76 | 77 | nrmse=zeros(Np,1); 78 | X2p=reshape(X3(:,:,ps),[Np,length(ps)])'; 79 | I2p=reshape(I3(:,:,ps),[Np,length(ps)])'; 80 | for ii=1:Np 81 | nrmse(ii)=norm(X2p(:,ii)-I2p(:,ii))/norm(I2p(:,ii))*100; 82 | end 83 | figure, plot(sort(nrmse)), title('spectrum of pan') 84 | xlabel('pixel number'), ylabel('per-pixel NRMSE (%)') 85 | 86 | nrmse=zeros(Np,1); 87 | X2=reshape(X3,[Np,Ns])'; 88 | for ii=1:Np 89 | nrmse(ii)=norm(X2(:,ii)-I2(:,ii))/norm(I2(:,ii))*100; 90 | end 91 | figure, plot(sort(nrmse)), title('entire spectrum') 92 | xlabel('pixel number'), ylabel('per-pixel NRMSE (%)') 93 | -------------------------------------------------------------------------------- /Pan__MS_HS.m: -------------------------------------------------------------------------------- 1 | % Pan + (MS + HS) 2 | 3 | clear 4 | addpath('function') 5 | 6 | load('Data\Botswana.mat') 7 | load('Noise\N_Botswana.mat') 8 | beta1=1.3e-4; % regularization parameter 9 | beta2=1.3e-4; % regularization parameter 10 | ps=14:36; 11 | % load('Data\IndianPines.mat') 12 | % load('Noise\N_IndianPines.mat') 13 | % beta1=1.2e-4; % regularization parameter 14 | % beta2=1.2e-4; 15 | % ps=10:30; 16 | % load('Data\DCMall.mat') 17 | % load('Noise\N_DCMall.mat') 18 | % beta1=4e-4; % regularization parameter 19 | % beta2=4e-4; 20 | % ps=24:53; 21 | % load('Data\Moffett.mat') 22 | % load('Noise\N_Moffett.mat') 23 | % beta1=8e-4; % regularization parameter 24 | % beta2=8e-4; 25 | % ps=14:36; 26 | % load('Data\KennedySpaceCenter.mat') 27 | % load('Noise\N_KennedySpaceCenter.mat') 28 | % beta1=8e-4; % regularization parameter 29 | % beta2=8e-4; 30 | % ps=14:36; 31 | 32 | % paramaters 33 | ni =200; % number of iterations 34 | snrh=30; % HS SNR (dB) 35 | snrm=30; % MS SNR (dB) 36 | snrp=40; % pan SNR (dB) 37 | mu =.02; % penalty parameter 38 | 39 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 40 | %% spectral responses 41 | Nm=7; % number of bands 42 | R=multibands_Landsat(w); 43 | c=R(6,:); 44 | c=c/sum(c); 45 | R(6,:)=[]; %%%%%%%%%%% 46 | R=R./(sum(R,2)*ones(1,Ns)); 47 | RE=R*E; 48 | cE=c*E; 49 | 50 | %% MTFs (blur kernels) 51 | rm =2; % MS spatial downsampling factor 52 | Npm=Np/rm^2; % MS number of pixels 53 | Km =fspecial('gaussian',[3,3],.8); % MS spatial filter kernel 54 | rh =4; % HS spatial downsampling factor 55 | Kh =conv2(Km,Km); % HS spatial filter kernel 56 | 57 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 58 | %% synthesize images 59 | [~,p2,~] =createPan(I2,nr,nc,c,nop,snrp); % Pan 60 | [~,M2,nrm,ncm,Sm]=createMS (I3,rm,Km,nr,nc,Ns,R,Nm,Nom,snrm); % MS 61 | [~,H2,nrh,nch,Sh]=createHS (I3,rh,Kh,nr,nc,Ns,Noh,snrh); % HS 62 | 63 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 64 | %% fusion 65 | % MS+HS 66 | [Y3,~,t1]=HySure(H2,M2,E,RE,Km,1,beta1,mu,ni,rh/rm,nrm,ncm,nrh,nch,Npm,Ns,Ne); 67 | %[Y3,~,t1]=RFUSE_TV(H2,M2,E,RE,Km,beta1,mu,ni,rh/rm,nrm,ncm,nrh,nch,Npm,Ns,Ne); 68 | Y2=reshape(Y3,[Npm,Ns])'; 69 | 70 | % Pan+(MS+HS) 71 | [X3,~,t2]=HySure(Y2,p2,E,cE,Km,1,beta2,mu,ni,rm,nr,nc,nrm,ncm,Np,Ns,Ne); 72 | %[X3,~,t2]=RFUSE_TV(Y2,p2,E,cE,Km,beta2,mu,ni,rm,nr,nc,nrm,ncm,Np,Ns,Ne); 73 | 74 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 75 | %% results 76 | [ergas,sam,q2n]=qual_assess(I3(:,:,ps),X3(:,:,ps),rh,length(ps),Np,32); 77 | fprintf('\n spectrum of pan\n ERGAS = %2.3f\n SAM = %2.3f\n Q2n = %2.3f',... 78 | ergas,sam,q2n) 79 | 80 | [ergas,sam,q2n]=qual_assess(I3,X3,rh,Ns,Np,32); 81 | fprintf('\n entire spectrum\n ERGAS = %2.3f\n SAM = %2.3f\n Q2n = %2.3f\n time = %2.3f\n'... 82 | ,ergas,sam,q2n,t1+t2) 83 | 84 | nrmse=zeros(Np,1); 85 | X2p=reshape(X3(:,:,ps),[Np,length(ps)])'; 86 | I2p=reshape(I3(:,:,ps),[Np,length(ps)])'; 87 | for ii=1:Np 88 | nrmse(ii)=norm(X2p(:,ii)-I2p(:,ii))/norm(I2p(:,ii))*100; 89 | end 90 | figure, plot(sort(nrmse)), title('spectrum of pan') 91 | xlabel('pixel number'), ylabel('per-pixel NRMSE (%)') 92 | 93 | nrmse=zeros(Np,1); 94 | X2=reshape(X3,[Np,Ns])'; 95 | for ii=1:Np 96 | nrmse(ii)=norm(X2(:,ii)-I2(:,ii))/norm(I2(:,ii))*100; 97 | end 98 | figure, plot(sort(nrmse)), title('entire spectrum') 99 | xlabel('pixel number'), ylabel('per-pixel NRMSE (%)') 100 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fusing multiple multiband images 2 | 3 | Data and MATLAB code for the simulations of [R. Arablouei, “Fusing multiple multiband images,” Journal of Imaging, 2018.] 4 | --------------------------------------------------------------------------------