求小波变换图像融合的MATLAB程序,毕设用。

2024-11-07 21:41:54
推荐回答(4个)
回答(1):

clc;
clear all;
close all; % 清理工作空间
clear
[imA,map1] = imread('A.tif');
M1 = double(imA) / 256;
[imB,map2] = imread('B.tif');
M2 = double(imB) / 256;

zt= 4;
wtype = 'haar';
% M1 - input image A
% M2 - input image B
% wtype使用的小波类型
% Y - fused image
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% 小波变换图像融合
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 小波变换的绝对值大的小波系数,对应着显著的亮度变化,也就是图像中的显著特征。所以,选择绝对值大
%% 的小波系数作为我们需要的小波系数。【注意,前面取的是绝对值大小,而不是实际数值大小】
%%
%% 低频部分系数采用二者求平均的方法
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[c0,s0] = wavedec2(M1, zt, wtype);%多尺度二维小波分解

[c1,s1] = wavedec2(M2, zt, wtype);%多尺度二维小波分解

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 后面就可以进行取大进行处理。然后进行重构,得到一个图像
%% 的小波系数,然后重构出总的图像效果。
%% 取绝对值大的小波系数,作为融合后的小波系数
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KK = size(c1);
Coef_Fusion = zeros(1,KK(2));
Temp = zeros(1,2);
Coef_Fusion(1:s1(1,1)) = (c0(1:s1(1,1))+c1(1:s1(1,1)))/2; %低频系数的处理
%这儿,连高频系数一起处理了,但是后面处理高频系数的时候,会将结果覆盖,所以没有关系

%处理高频系数
MM1 = c0(s1(1,1)+1:KK(2));
MM2 = c1(s1(1,1)+1:KK(2));
mm = (abs(MM1)) > (abs(MM2));
Y = (mm.*MM1) + ((~mm).*MM2);
Coef_Fusion(s1(1,1)+1:KK(2)) = Y;
%处理高频系数end

%重构
Y = waverec2(Coef_Fusion,s0,wtype);

%显示图像
subplot(2,2,1);imshow(M1);
colormap(gray);
title('input2');
axis square

subplot(2,2,2);imshow(M2);
colormap(gray);
title('input2');
axis square

subplot(223);imshow(Y,[]);
colormap(gray);
title('融合图像');
axis square;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

回答(2):

小波变换图像融合的MATLAB程序,这个在国内很少有人学,你可能搜索不到,我都是前几天去听了一个信李的导师的讲座才知道的

回答(3):

lear all;
close all;
clc;
mul=imread('TM-30m_24_BSQ_1.jpg');
figure,imshow(mul)
whos;
hr=imread('bldr_sp_8_gray_1.jpg ');
figure,imshow(hr)
whos;
mul=rgb2hsv(mul);
mul_r=mul(:,:,1);
mul_g=mul(:,:,2);
mul_b=mul(:,:,3);
[c_hr s_hr]=wavedec2(hr,1,'sym4');
[c_r s_r]=wavedec2(mul_r,1,'sym4');
[c_g s_g]=wavedec2(mul_g,1,'sym4');
[c_b s_b]=wavedec2(mul_b,1,'sym4');
c_r=0.5*(c_hr+c_r);
c_g=0.5*(c_hr+c_g);
c_b=0.5*(c_hr+c_b);
f_r=waverec2(c_r,s_hr,'sym4');
f_r=histeq(f_r);
f_g=waverec2(c_g,s_hr,'sym4');
f_g=histeq(f_g);
f_b=waverec2(c_b,s_hr,'sym4');
f_b=histeq(f_b);
fc=cat(3,f_r,f_g,f_b);
figure,imshow(fc)

回答(4):

我有。但我的是买来的。我做的是Morlet小波变换