算了 还是贴出来把 附件怕失效 图片自己imread进去哈
clear;
close all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5%%%%%%%%%%%%%%%%%%%%555
%%读入图像并显示
[f1,map1]=imread('clock1.gif');
imshow(f1,map1);title('clock1');
[f2,map2]=imread('clock2.gif');
figure;imshow(f2,map2);title('clock2')'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%小波分解
[c1,s1]=wavedec2(f1,3,'bior2.4');
[c2,s2]=wavedec2(f2,3,'bior2.4');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%系数提取
h11=detcoef2('h',c1,s1,1);%figure;imshow(h11);title('h11');
v11=detcoef2('v',c1,s1,1);%figure;imshow(v11);title('v11');
d11=detcoef2('d',c1,s1,1);%figure;imshow(d11);title('d11');
h12=detcoef2('h',c1,s1,2);%figure;imshow(h11);title('h12');
v12=detcoef2('v',c1,s1,2);%figure;imshow(v11);title('v12');
d12=detcoef2('d',c1,s1,2);%figure;imshow(d11);title('d12');
a13=appcoef2(c1,s1,'bior2.4',3);%figure;imshow(a13,[]);title('a13');
h13=detcoef2('h',c1,s1,3);%figure;imshow(h13);title('h13');
v13=detcoef2('v',c1,s1,3);%figure;imshow(v13);title('v13');
d13=detcoef2('d',c1,s1,3);%figure;imshow(d13);title('d13');
h21=detcoef2('h',c2,s2,1);%figure;imshow(h21);title('h21');
v21=detcoef2('v',c2,s2,1);%figure;imshow(v21);title('v21');
d21=detcoef2('d',c1,s1,1);%figure;imshow(d21);title('d21');
h22=detcoef2('h',c2,s2,2);%figure;imshow(h22);title('h22');
v22=detcoef2('v',c2,s2,2);%figure;imshow(v22);title('v22');
d22=detcoef2('d',c2,s2,2);%figure;imshow(d22);title('d22');
a23=appcoef2(c2,s2,'bior2.4',3);%figure;imshow(a23,[]);title('a23');
h23=detcoef2('h',c2,s2,3);%figure;imshow(h23);title('h23');
v23=detcoef2('v',c2,s2,3);%figure;imshow(v23);title('v23');
d23=detcoef2('d',c1,s1,3);%figure;imshow(d23);title('d23');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%按融合规则对系数进行处理
[m,n]=size(h11);
for i=1:m
for j=1:n
if (abs(h11(i,j))
end
end
end
[m,n]=size(v11);
for i=1:m
for j=1:n
if (abs(v11(i,j))
end
end
end
[m,n]=size(d11);
for i=1:m
for j=1:n
if (abs(d11(i,j))
end
end
end
[m,n]=size(h12);
for i=1:m
for j=1:n
if (abs(h12(i,j))
end
end
end
[m,n]=size(v12);
for i=1:m
for j=1:n
if (abs(v12(i,j))
end
end
end
[m,n]=size(d12);
for i=1:m
for j=1:n
if (abs(d12(i,j))
end
end
end
[m,n]=size(a13);
for i=1:m
for j=1:n
a13(i,j)=a13(i,j)*0.5+a23(i,j)*0.5;
end
end
[m,n]=size(h13);
for i=1:m
for j=1:n
if (abs(h13(i,j))
end
end
end
[m,n]=size(v13);
for i=1:m
for j=1:n
if (abs(v13(i,j))
end
end
end
[m,n]=size(d13);
for i=1:m
for j=1:n
if (abs(d13(i,j))
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 图像重构
a12=idwt2(a13,h13,v13,d13,'bior2.4');%1figure;imshow(a12,[]);title('a12');
a11=idwt2(a12,h12,v12,d12,'bior2.4');%1figure;imshow(a11,[]);title('a11');%262 262
f=idwt2(a11,h11,v11,d11,'bior2.4');figure;imshow(f,[]);title('fusion picture_ bior2.4');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 计算RMS和PSNR以及熵
I=double(f);
J=imread('BABOO.bmp');
J=double(J);
for i=1:512
for j=1:512
xx=sum(I(i,j)-J(i,j))^2;
end
end
RMSE=sqrt(xx/(512*512));
PSNR=10*log((255*255)/RMSE);
shang1=entropy(f1);
shang2=entropy(f2);
shang3=entropy(f);
小波包变换的。
程序的是。
任务是、。按要求的是。