【图像融合】基于小波变换的图像融合【Matlab 309期】

一、简介

1974年，法国工程师J.Morlet首先提出小波变换的概念，1986年著名数学家Y.Meyer偶然构造出一个真正的小波基，并与S.Mallat合作建立了构造小波基的多尺度分析之后，小波分析才开始蓬勃发展起来。小波分析的应用领域十分广泛，在数学方面，它已用于数值分析、构造快速数值方法、曲线曲面构造、微分方程求解、控制论等。在信号分析方面的滤波、去噪声、压缩、传递等。在图像处理方面的图像压缩、分类、识别与诊断，去噪声等。本章将着重阐述小波在图像中的应用分析。
1 小波变换原理

（1）小波分析用于信号与图像压缩。小波压缩的特点是压缩比高，压缩速度快，压缩后能保持信号与图像的特征不变，且在传递中能够抗干扰。基于小波分析的压缩方法很多，具体有小波压缩，小波包压缩，小波变换向量压缩等。
（2）小波也可以用于信号的滤波去噪、信号的时频分析、信噪分离与提取弱信号、求分形指数、信号的识别与诊断以及多尺度边缘检测等。
（3）小波分析在工程技术等方面的应用概括的包括计算机视觉、曲线设计、湍流、远程宇宙的研究与生物医学方面。
2 多尺度分析

3 图像的分解和量化

4 图像压缩编码

5 图像编码评价

二、源代码

clear
M1 = double(imA) / 256;
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

12-08

10-01
03-30
05-02
01-04
12-07
12-18
10-30
10-04 2万+
05-24
10-15
10-22 1万+