1 简介
基于Matlab强大的图像处理工具箱函数,用加权平均法、拉普拉斯金字塔变换法、小波变换法对图像进行融合,然后用客观评价法中的相应评价指标对其融合结果进行质量评价。实验表明,小波变换法的图像融合效果最好。
2 部分代码
function varargout = imageprocess(varargin) % IMAGEPROCESS MATLAB code for imageprocess.fig % IMAGEPROCESS, by itself, creates a new IMAGEPROCESS or raises the existing % singleton*. % % H = IMAGEPROCESS returns the handle to a new IMAGEPROCESS or the handle to % the existing singleton*. % % IMAGEPROCESS('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in IMAGEPROCESS.M with the given input arguments. % % IMAGEPROCESS('Property','Value',...) creates a new IMAGEPROCESS or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before imageprocess_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to imageprocess_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 imageprocess % Last Modified by GUIDE v2.5 21-Apr-2015 22:09:41 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @imageprocess_OpeningFcn, ... 'gui_OutputFcn', @imageprocess_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 imageprocess is made visible. function imageprocess_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 imageprocess (see VARARGIN) % Choose default command line output for imageprocess handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes imageprocess wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = imageprocess_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; % --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global im1 [filename, pathname]=uigetfile({'*.*';'*.bmp';'*.jpg';'*.tif';'*.jpg';'*.png'},'打开图片'); str1=[pathname filename]; im1=imread(str1); axes(handles.axes1); imshow(im1); % --- 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) global im2 [filename, pathname]=uigetfile({'*.*';'*.bmp';'*.jpg';'*.tif';'*.jpg';'*.png'},'打开图片'); str1=[pathname filename]; im2=imread(str1); axes(handles.axes2); imshow(im2); % --- Executes on button press in pushbutton7. function pushbutton7_Callback(hObject, eventdata, handles) % hObject handle to pushbutton7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close(gcf); % --- Executes during object creation, after setting all properties. function axes3_CreateFcn(hObject, eventdata, handles) % hObject handle to axes3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: place code in OpeningFcn to populate axes3 % --- Executes on button press in pushbutton3. function pushbutton11_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes when selected object is changed in uipanel2. % --- Executes when selected object is changed in uipanel3. function uipanel3_SelectionChangeFcn(hObject, eventdata, handles) % hObject handle to the selected object in uipanel3 % eventdata structure with the following fields (see UIBUTTONGROUP) %EventName: string 'SelectionChanged' (read only) %OldValue: handle of the previously selected object or empty if none was selected %NewValue: handle of the currently selected object % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_1_Callback(hObject, eventdata, handles) % hObject handle to Untitled_1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_3_Callback(hObject, eventdata, handles) % hObject handle to Untitled_3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_13_Callback(hObject, eventdata, handles) % hObject handle to Untitled_13 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_27_Callback(hObject, eventdata, handles) % hObject handle to Untitled_27 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_28_Callback(hObject, eventdata, handles) % hObject handle to Untitled_28 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global im1 global im2 im11 = double(im1)/255; im22 = double(im2)/255; %普拉斯金塔变换参数 mp = 3;zt =4; cf =1;ar = 1; cc = [cf ar]; Y_lap = fuse_lap(im11,im22,zt,cc,mp); axes(handles.axes4); imshow(Y_lap); % -------------------------------------------------------------------- function Untitled_29_Callback(hObject, eventdata, handles) % hObject handle to Untitled_29 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_14_Callback(hObject, eventdata, handles) % hObject handle to Untitled_14 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) im=handles.img; se=strel('disk',4); im3=imerode(im,se); axes(handles.axes3); imshow(im3); handles.img=im3; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_15_Callback(hObject, eventdata, handles) % hObject handle to Untitled_15 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) im=handles.img; se=strel('disk',4); im3=imdilate(im,se); axes(handles.axes3); imshow(im3); handles.img=im3; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_16_Callback(hObject, eventdata, handles) % hObject handle to Untitled_16 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) im=handles.img; se=strel('disk',4); im3=imopen(im,se); axes(handles.axes3); imshow(im3); handles.img=im3; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_17_Callback(hObject, eventdata, handles) % hObject handle to Untitled_17 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) im=handles.img; se=strel('disk',4); im3=imclose(im,se); axes(handles.axes3); imshow(im3); handles.img=im3; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_4_Callback(hObject, eventdata, handles) % hObject handle to Untitled_4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB global im1 if isgray(im1)==0 im3=rgb2gray(im1); else im3=im1; end axes(handles.axes3); imshow(im3); handles.img=im3; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_5_Callback(hObject, eventdata, handles) % hObject handle to Untitled_5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_7_Callback(hObject, eventdata, handles) % hObject handle to Untitled_7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_8_Callback(hObject, eventdata, handles) % hObject handle to Untitled_8 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_12_Callback(hObject, eventdata, handles) % hObject handle to Untitled_12 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_22_Callback(hObject, eventdata, handles) % hObject handle to Untitled_22 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global im1 [filename, pathname]=uigetfile({'*.*';'*.bmp';'*.jpg';'*.tif';'*.jpg';'*.png'},'打开图片'); str1=[pathname filename]; im1=imread(str1); axes(handles.axes1); imshow(im1); % -------------------------------------------------------------------- function Untitled_23_Callback(hObject, eventdata, handles) % hObject handle to Untitled_23 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global im2 [filename, pathname]=uigetfile({'*.*';'*.bmp';'*.jpg';'*.tif';'*.jpg';'*.png'},'打开图片'); str1=[pathname filename]; im2=imread(str1); axes(handles.axes2); imshow(im2); % -------------------------------------------------------------------- function Untitled_24_Callback(hObject, eventdata, handles) % hObject handle to Untitled_24 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_25_Callback(hObject, eventdata, handles) % hObject handle to Untitled_25 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_18_Callback(hObject, eventdata, handles) % hObject handle to Untitled_18 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) im=handles.img; axes (handles.axes3); BW=edge(im,'sobel'); imshow(BW); handles.img=BW; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_19_Callback(hObject, eventdata, handles) % hObject handle to Untitled_19 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) im=handles.img; axes (handles.axes3); BW=edge(im,'prewitt'); imshow(BW); handles.img=BW; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_20_Callback(hObject, eventdata, handles) % hObject handle to Untitled_20 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) im=handles.img; axes (handles.axes3); BW=edge(im,'canny'); imshow(BW); handles.img=BW; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_9_Callback(hObject, eventdata, handles) % hObject handle to Untitled_9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) a=handles.img; b=iteration(a); axes(handles.axes3); imshow(b); handles.img=b; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_11_Callback(hObject, eventdata, handles) % hObject handle to Untitled_11 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) a=handles.img; t=graythresh(a); b=im2bw(a,t); axes(handles.axes3); imshow(b); handles.img=b; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_30_Callback(hObject, eventdata, handles) % hObject handle to Untitled_30 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_31_Callback(hObject, eventdata, handles) % hObject handle to Untitled_31 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) im1=imadjust(handles.img); axes(handles.axes3); imshow(im1); handles.img=im1; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_32_Callback(hObject, eventdata, handles) % hObject handle to Untitled_32 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) im1=histeq(handles.img); axes(handles.axes3); imshow(im1); handles.img=im1; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_33_Callback(hObject, eventdata, handles) % hObject handle to Untitled_33 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) axes(handles.axes3); im5=wiener2(handles.img,[5,5]); imshow(im5); handles.img=im5; guidata(hObject,handles); % -------------------------------------------------------------------- function Untitled_34_Callback(hObject, eventdata, handles) % hObject handle to Untitled_34 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) axes(handles.axes3); im5=medfilt2(handles.img,[5,5]); imshow(im5); handles.img=im5; guidata(hObject,handles); % --- Executes on button press in pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global im1 if isgray(im1)==0 im3=rgb2gray(im1); else im3=im1; end axes(handles.axes3); imshow(im3); handles.img=im3; guidata(hObject,handles);
3 仿真结果
4 参考文献
[1]陈晓, & 唐诗华. (2014). 基于matlab的图像融合方法及性能评价. 地理空间信息, 12(6), 3.