【圖像融合】基于小波變換算法實(shí)現(xiàn)可見(jiàn)光與紅外光圖像融合系統(tǒng)matlab代碼
【圖像融合】基于小波變換算法實(shí)現(xiàn)可見(jiàn)光與紅外光圖像融合系統(tǒng)matlab代碼
1 簡(jiǎn)介
由于紅外成像儀器本身存在缺陷和環(huán)境的影 響 , 造成圖像成像效果不是很理想 , 噪聲大 , 視覺(jué) 效果不好 , 這些都會(huì)影響融合的效果 。 所以在圖 像融合之前先進(jìn)行圖像的去噪 、 增強(qiáng)等處理 , 改善 紅外圖像的視覺(jué)效果 。 采用分段函數(shù)對(duì)紅外圖 像進(jìn)行增強(qiáng) , 提高圖像的動(dòng)態(tài)范圍 , 增加圖像的對(duì) 比度 , 使圖像更加清晰明顯 , 以便于進(jìn)行最后的 融合 。 在圖像融合的過(guò)程中融合規(guī)則往往比較重 要 , 基于像素的融合方法不能反映一定區(qū)域內(nèi)像 素之間的關(guān)系 , 而人眼對(duì)像素的感知也是區(qū)域性 的 , 基于像素的方法往往具有片面性 。 通過(guò)改 進(jìn)的小波算法把紅外圖像和可見(jiàn)光圖像進(jìn)行分 解 , 分別得到圖像的低頻系數(shù)部分和高頻系數(shù)部 分 , 低頻部分采用梯度求和加權(quán)的融合規(guī)則 , 高頻 部分采用區(qū)域相關(guān)性方差的融合規(guī)則 , 最后再對(duì) 低頻部分和高頻部分進(jìn)行小波重構(gòu) 得到最后的 融合圖像 。 改進(jìn)的算法融合流程如圖 1 所示 。 經(jīng)過(guò)小波的 4 層分解得到分層圖 , 圖 2a 為 可見(jiàn)光圖像小波分解圖示 , 圖 2b 為紅外圖像小波 分解圖示 , 經(jīng)過(guò)逐層分解 , 得到原圖像的不同頻段 。
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;’ , ’請(qǐng)選擇圖像數(shù)據(jù)’ ); 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;’ , ’請(qǐng)選擇圖像數(shù)據(jù)’ ); 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 仿真結(jié)果
4 參考文獻(xiàn)
[1]許凡. 紅外與可見(jiàn)光圖像融合技術(shù)的研究[D]. 中國(guó)科學(xué)院研究生院(西安光學(xué)精密機(jī)械研究所).
微信掃一掃贊賞作者
贊賞
發(fā)送給作者
人贊賞
長(zhǎng)按二維碼向我轉(zhuǎn)賬
受蘋(píng)果公司新規(guī)定影響,微信 iOS 版的贊賞功能被關(guān)閉,可通過(guò)二維碼轉(zhuǎn)賬支持公眾號(hào)。
-
Origin(Pro):學(xué)習(xí)版的窗口限制【數(shù)據(jù)繪圖】 2020-08-07
-
如何卸載Aspen Plus并再重新安裝,這篇文章告訴你! 2020-05-29
-
CAD視口的邊框線看不到也選不中是怎么回事,怎么解決? 2020-06-04
-
教程 | Origin從DSC計(jì)算焓和比熱容 2020-08-31
-
CAD外部參照無(wú)法綁定怎么辦? 2020-06-03
-
CAD中如何將布局連帶視口中的內(nèi)容復(fù)制到另一張圖中? 2020-07-03
