首页 > 化工知识 > 【图像融合】基于小波变换算法实现可见光与红外光图像融合系统matlab代码

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

时间:2021-11-25 来源: 浏览:

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

原创 天天Matlab 天天Matlab
天天Matlab

TT_Matlab

每天分享一点Matlab资料,一起成长进步。需要定制程序添加qq1575304183

收录于话题 #图像处理matlab源码 254个 内容

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]. 中国科学院研究生院(西安光学精密机械研究所).

天天Matlab

赞赏二维码 微信扫一扫赞赏作者 赞赏

已喜欢, 对作者说句悄悄话
最多40字,当前共 字

  人赞赏

1 / 3

长按二维码向我转账

赞赏二维码

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

版权:如无特殊注明,文章转载自网络,侵权请联系cnmhg168#163.com删除!文件均为网友上传,仅供研究和学习使用,务必24小时内删除。
相关推荐