【图像融合】基于小波变换算法实现可见光与红外光图像融合系统matlab代码

1 简介

由于红外成像仪器本身存在缺陷和环境的影响,造成图像成像效果不是很理想,噪声大,视觉效果不好,这些都会影响融合的效果。所以在图像融合之前先进行图像的去噪、增强等处理,改善红外图像的视觉效果。采用分段函数对红外图像进行增强,提高图像的动态范围,增加图像的对比度,使图像更加清晰明显,以便于进行最后的融合。在图像融合的过程中融合规则往往比较重要,基于像素的融合方法不能反映一定区域内像素之间的关系,而人眼对像素的感知也是区域性的,基于像素的方法往往具有片面性。通过改进的小波算法把红外图像和可见光图像进行分解,分别得到图像的低频系数部分和高频系数部分,低频部分采用梯度求和加权的融合规则,高频部分采用区域相关性方差的融合规则,最后再对低频部分和高频部分进行小波重构得到最后的融合图像。改进的算法融合流程如图 1 所示。经过小波的 4 层分解得到分层图,图 2a 为可见光图像小波分解图示,图 2b 为红外图像小波分解图示,经过逐层分解,得到原图像的不同频段。​

 

2 部分代码

function varargout = main(varargin)
% MAIN MATLAB code for main.fig
%     MAIN, by itself, creates a new MAIN or raises the existing
%     singleton*.
%
%     H = MAIN returns the handle to a new MAIN or the handle to
%     the existing singleton*.
%
%     MAIN('CALLBACK',hObject,eventData,handles,...) calls the local
%     function named CALLBACK in MAIN.M with the given input arguments.
%
%     MAIN('Property','Value',...) creates a new MAIN or raises the
%     existing singleton*. Starting from the left, property value pairs are
%     applied to the GUI before main_OpeningFcn gets called. An
%     unrecognized property name or invalid value makes property application
%     stop. All inputs are passed to main_OpeningFcn via varargin.
%
%     *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
%     instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help main

% Last Modified by GUIDE v2.5 14-Dec-2017 19:28:26

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                  'gui_Singleton',  gui_Singleton, ...
                  'gui_OpeningFcn', @main_OpeningFcn, ...
                  'gui_OutputFcn',  @main_OutputFcn, ...
                  'gui_LayoutFcn', [] , ...
                  'gui_Callback',   []);
if nargin && ischar(varargin{1})
   gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
  [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
   gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before main is made visible.
function main_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject   handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% varargin   command line arguments to main (see VARARGIN)
2(i,j,k)) > abs(VcV2(i,j,k))
             cV20(i,j,k) = RcV2(i,j,k);      
       else
             cV20(i,j,k) = VcV2(i,j,k); 
       end
       if abs(RcD2(i,j,k)) > abs(VcD2(i,j,k))
             cD20(i,j,k) = RcD2(i,j,k);      
       else
             cD20(i,j,k) = VcD2(i,j,k); 
       end        
       end
   end
end
%%%%%%反变换
img_fuse2 = idwt2(cA20,cH20,cV20,cD20,'sym4');%LL1,HL1,LH1,HH1
img_fuse2 = img_fuse2(1:M1,1:N1,1:3);
img_fuse0 = idwt2(img_fuse2,cH10,cV10,cD10,'sym4');
for k=1:3
%     a=max(max(img_fuse0(:,:,k)));
%     b=min(min(img_fuse0(:,:,k)));
%     img_fuse0(:,:,k)=1/(b-a)*img_fuse0(:,:,k)-(1/(b-a)*a);
a=max(max(img_fuse0(:,:,k)));
img_fuse0(:,:,k)= img_fuse0(:,:,k)./a;
end
axes(handles.axes3);
imshow(img_fuse0);
guidata(hObject, handles);


% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject   handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
[FileName, FilePath]=uigetfile('*.tif;*.jpg;*.png;*.img;*.gif;*.bmp;','请选择图像数据');
str=[FilePath FileName];
image_1=imread(str);
handles.imfusion1=image_1;
axes(handles.axes1);
imshow(image_1);
[FileName, FilePath]=uigetfile('*.tif;*.jpg;*.png;*.img;*.gif;*.bmp;','请选择图像数据');
str=[FilePath FileName];
image_1=imread(str);
handles.imfusion2=image_1;
axes(handles.axes2);
imshow(image_1);
guidata(hObject, handles);


% --- Executes when uipanel1 is resized.
function uipanel1_ResizeFcn(hObject, eventdata, handles)
% hObject   handle to uipanel1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)

3 仿真结果

4 参考文献

[1]许凡. 红外与可见光图像融合技术的研究[D]. 中国科学院研究生院(西安光学精密机械研究所).

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Matlab科研辅导帮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值