【图像融合】基于小波变换算法实现可见光与红外光图像融合系统matlab代码
【图像融合】基于小波变换算法实现可见光与红外光图像融合系统matlab代码
TT_Matlab
每天分享一点Matlab资料,一起成长进步。需要定制程序添加qq1575304183
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]. 中国科学院研究生院(西安光学精密机械研究所).
微信扫一扫赞赏作者
赞赏
发送给作者
人赞赏
长按二维码向我转账
受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。
-
Origin(Pro):学习版的窗口限制【数据绘图】 2020-08-07
-
如何卸载Aspen Plus并再重新安装,这篇文章告诉你! 2020-05-29
-
AutoCAD 保存时出现错误:“此图形中的一个或多个对象无法保存为指定格式”怎么办? 2020-08-03
-
OriginPro:学习版申请及过期激活方法【数据绘图】 2020-08-06
-
CAD视口的边框线看不到也选不中是怎么回事,怎么解决? 2020-06-04
-
教程 | Origin从DSC计算焓和比热容 2020-08-31
-
如何评价拟合效果-Origin(Pro)数据拟合系列教程【数据绘图】 2020-08-06
-
Aspen Plus安装过程中RMS License证书安装失败的解决方法,亲测有效! 2021-10-15
-
CAD外部参照无法绑定怎么办? 2020-06-03
-
CAD中如何将布局连带视口中的内容复制到另一张图中? 2020-07-03