1 简介

2 部分代码

function varargout = gui(varargin)
  • 1.
% GUI M-file for gui.fig
  • 1.
%     GUI, by itself, creates a new GUI or raises the existing
  • 1.
%     singleton*.
  • 1.
%
  • 1.
%     H = GUI returns the handle to a new GUI or the handle to
  • 1.
%     the existing singleton*.
  • 1.
%
  • 1.
%     GUI('CALLBACK',hObject,eventData,handles,...) calls the local
  • 1.
%     function named CALLBACK in GUI.M with the given input arguments.
  • 1.
%
  • 1.
%     GUI('Property','Value',...) creates a new GUI or raises the
  • 1.
%     existing singleton*. Starting from the left, property value pairs are
  • 1.
%     applied to the GUI before gui_OpeningFcn gets called. An
  • 1.
%     unrecognized property name or invalid value makes property application
  • 1.
%     stop. All inputs are passed to gui_OpeningFcn via varargin.
  • 1.
%
  • 1.
%     *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
  • 1.
%     instance to run (singleton)".
  • 1.
%
  • 1.
% See also: GUIDE, GUIDATA, GUIHANDLES
  • 1.
  • 1.
% Edit the above text to modify the response to help gui
  • 1.
  • 1.
% Last Modified by GUIDE v2.5 27-May-2011 17:39:18
  • 1.
  • 1.
% Begin initialization code - DO NOT EDIT
  • 1.
gui_Singleton = 1;
  • 1.
gui_State = struct('gui_Name',       mfilename, ...
  • 1.
                  'gui_Singleton',  gui_Singleton, ...
  • 1.
                  'gui_OpeningFcn', @gui_OpeningFcn, ...
  • 1.
                  'gui_OutputFcn',  @gui_OutputFcn, ...
  • 1.
                  'gui_LayoutFcn', [] , ...
  • 1.
                  'gui_Callback',   []);
  • 1.
if nargin && ischar(varargin{1})
  • 1.
   gui_State.gui_Callback = str2func(varargin{1});
  • 1.
end
  • 1.
  • 1.
if nargout
  • 1.
  [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  • 1.
else
  • 1.
   gui_mainfcn(gui_State, varargin{:});
  • 1.
end
  • 1.
% End initialization code - DO NOT EDIT
  • 1.
  • 1.
  • 1.
% --- Executes just before gui is made visible.
  • 1.
function gui_OpeningFcn(hObject, eventdata, handles, varargin)
  • 1.
% This function has no output args, see OutputFcn.
  • 1.
% hObject   handle to figure
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   structure with handles and user data (see GUIDATA)
  • 1.
% varargin   command line arguments to gui (see VARARGIN)
  • 1.
  • 1.
% Choose default command line output for gui
  • 1.
handles.output = hObject;
  • 1.
  • 1.
% Update handles structure
  • 1.
guidata(hObject, handles);
  • 1.
  • 1.
% UIWAIT makes gui wait for user response (see UIRESUME)
  • 1.
% uiwait(handles.figure1);
  • 1.
  • 1.
  • 1.
% --- Outputs from this function are returned to the command line.
  • 1.
function varargout = gui_OutputFcn(hObject, eventdata, handles) 
  • 1.
% varargout cell array for returning output args (see VARARGOUT);
  • 1.
% hObject   handle to figure
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   structure with handles and user data (see GUIDATA)
  • 1.
  • 1.
% Get default command line output from handles structure
  • 1.
varargout{1} = handles.output;
  • 1.
  • 1.
  • 1.
% --------------------------------------------------------------------
  • 1.
function Open_Callback(hObject, eventdata, handles)
  • 1.
[name,path]=uigetfile( ...
  • 1.
  {'*.jpg;*.tif;*.png;*.gif;*.bmp','All Image Files';...
  • 1.
   '*.*','All Files' },...
  • 1.
   '请选择要融合的低分辨率图片');
  • 1.
fullpath=strcat(path,name);
  • 1.
[name2,path2]=uigetfile( ...
  • 1.
  {'*.jpg;*.tif;*.png;*.gif;*.bmp','All Image Files';...
  • 1.
   '*.*','All Files' },...
  • 1.
   '请选择要融合的高分辨率图片(');
  • 1.
fullpath2=strcat(path2,name2);
  • 1.
save path.mat fullpath fullpath2
  • 1.
% hObject   handle to Open (see GCBO)
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   structure with handles and user data (see GUIDATA)
  • 1.
  • 1.
  • 1.
% --- Executes during object creation, after setting all properties.
  • 1.
function axes1_CreateFcn(hObject, eventdata, handles)
  • 1.
% hObject   handle to axes1 (see GCBO)
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   empty - handles not created until after all CreateFcns called
  • 1.
  • 1.
% Hint: place code in OpeningFcn to populate axes1
  • 1.
  • 1.
  • 1.
% --- Executes on button press in add_fu_button.
  • 1.
function add_fu_button_Callback(hObject, eventdata, handles)
  • 1.
axes(handles.axes1);
  • 1.
cla;
  • 1.
axes(handles.axes2);
  • 1.
cla;
  • 1.
axes(handles.axes3);
  • 1.
cla;
  • 1.
a=get(handles.radiobutton5,'value');
  • 1.
b=get(handles.radiobutton6,'value');
  • 1.
c=get(handles.radiobutton7,'value');
  • 1.
if a==1
  • 1.
   load path.mat
  • 1.
   axes(handles.axes1);
  • 1.
   low=imread(fullpath);
  • 1.
   imshow(low);
  • 1.
   axes(handles.axes2);
  • 1.
   high=imread(fullpath2);
  • 1.
   imshow(high);
  • 1.
   addfusion;
  • 1.
   load image.mat
  • 1.
   axes(handles.axes3);
  • 1.
   imshow(fusionresult);
  • 1.
   %
  • 1.
end
  • 1.
if b==1
  • 1.
   load path.mat
  • 1.
   axes(handles.axes1);
  • 1.
   low=imread(fullpath);
  • 1.
   imshow(low);
  • 1.
   axes(handles.axes2);
  • 1.
   high=imread(fullpath2);
  • 1.
   imshow(high);
  • 1.
   sel_h_fusion;
  • 1.
   load image.mat
  • 1.
   axes(handles.axes3);
  • 1.
   imshow(fusionresult);
  • 1.
   %
  • 1.
end
  • 1.
if c==1
  • 1.
   load path.mat
  • 1.
   axes(handles.axes1);
  • 1.
   low=imread(fullpath);
  • 1.
   imshow(low);
  • 1.
   axes(handles.axes2);
  • 1.
   high=imread(fullpath2);
  • 1.
   imshow(high);
  • 1.
   sel_l_fusion;
  • 1.
   load image.mat
  • 1.
   axes(handles.axes3);
  • 1.
   imshow(fusionresult);
  • 1.
   %
  • 1.
end
  • 1.
  • 1.
  • 1.
  • 1.
%axes(handles.axes4);
  • 1.
%cla;
  • 1.
%load path.mat
  • 1.
%axes(handles.axes1);
  • 1.
%low=imread(fullpath);
  • 1.
%imshow(low);
  • 1.
%axes(handles.axes2);
  • 1.
%high=imread(fullpath2);
  • 1.
%imshow(high);
  • 1.
%addfusion;
  • 1.
%load image.mat
  • 1.
%axes(handles.axes3);
  • 1.
  • 1.
%imshow(fusionresult);
  • 1.
% hObject   handle to add_fu_button (see GCBO)
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   structure with handles and user data (see GUIDATA)
  • 1.
  • 1.
  • 1.
% --- Executes on button press in pretreat_button.
  • 1.
function pretreat_button_Callback(hObject, eventdata, handles)
  • 1.
load path.mat
  • 1.
axes(handles.axes4);
  • 1.
low=imread(fullpath);
  • 1.
imshow(low);
  • 1.
axes(handles.axes5);
  • 1.
high=imread(fullpath2);
  • 1.
imshow(high);
  • 1.
pretreat;
  • 1.
load image.mat
  • 1.
NbColors=255;
  • 1.
map=gray(NbColors);
  • 1.
axes(handles.axes6);
  • 1.
image(pretreat_result_low);
  • 1.
colormap(map);
  • 1.
axes(handles.axes7);
  • 1.
image(pretreat_result_high);
  • 1.
colormap(map);
  • 1.
  • 1.
  • 1.
  • 1.
  • 1.
% hObject   handle to pretreat_button (see GCBO)
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   structure with handles and user data (see GUIDATA)
  • 1.
  • 1.
  • 1.
% --- Executes on button press in gauss_button1.
  • 1.
function gauss_button1_Callback(hObject, eventdata, handles)
  • 1.
axes(handles.axes4);
  • 1.
cla;
  • 1.
axes(handles.axes5);
  • 1.
cla;
  • 1.
axes(handles.axes6);
  • 1.
cla;
  • 1.
axes(handles.axes7);
  • 1.
cla;
  • 1.
gauss;
  • 1.
load image.mat
  • 1.
NbColors=255;
  • 1.
map=gray(NbColors);
  • 1.
axes(handles.axes4);
  • 1.
image(g0l);
  • 1.
colormap(map);
  • 1.
axes(handles.axes5);
  • 1.
image(g1l);
  • 1.
colormap(map);
  • 1.
axes(handles.axes6);
  • 1.
image(g2l);
  • 1.
colormap(map);
  • 1.
axes(handles.axes7);
  • 1.
image(g3l);
  • 1.
colormap(map);
  • 1.
  • 1.
% hObject   handle to gauss_button1 (see GCBO)
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   structure with handles and user data (see GUIDATA)
  • 1.
  • 1.
  • 1.
% --- Executes on button press in gauss_button2.
  • 1.
function gauss_button2_Callback(hObject, eventdata, handles)
  • 1.
axes(handles.axes4);
  • 1.
cla;
  • 1.
axes(handles.axes5);
  • 1.
cla;
  • 1.
axes(handles.axes6);
  • 1.
cla;
  • 1.
axes(handles.axes7);
  • 1.
cla;
  • 1.
%gauss;
  • 1.
load image.mat
  • 1.
NbColors=255;
  • 1.
map=gray(NbColors);
  • 1.
axes(handles.axes4);
  • 1.
image(g0h);
  • 1.
colormap(map);
  • 1.
axes(handles.axes5);
  • 1.
image(g1h);
  • 1.
colormap(map);
  • 1.
axes(handles.axes6);
  • 1.
image(g22h);
  • 1.
colormap(map);
  • 1.
axes(handles.axes7);
  • 1.
image(g3h);
  • 1.
colormap(map);
  • 1.
  • 1.
% hObject   handle to gauss_button2 (see GCBO)
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   structure with handles and user data (see GUIDATA)
  • 1.
  • 1.
  • 1.
% --- Executes on button press in lap_button1.
  • 1.
function lap_button1_Callback(hObject, eventdata, handles)
  • 1.
axes(handles.axes4);
  • 1.
cla;
  • 1.
axes(handles.axes5);
  • 1.
cla;
  • 1.
axes(handles.axes6);
  • 1.
cla;
  • 1.
axes(handles.axes7);
  • 1.
cla;
  • 1.
lap
  • 1.
load image.mat
  • 1.
NbColors=255;
  • 1.
map=gray(NbColors);
  • 1.
axes(handles.axes4);
  • 1.
image(lp0l);
  • 1.
colormap(map);
  • 1.
axes(handles.axes5);
  • 1.
image(lp1l);
  • 1.
colormap(map);
  • 1.
axes(handles.axes6);
  • 1.
image(lp2l);
  • 1.
colormap(map);
  • 1.
axes(handles.axes7);
  • 1.
image(lp3l);
  • 1.
colormap(map);
  • 1.
  • 1.
% hObject   handle to lap_button1 (see GCBO)
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   structure with handles and user data (see GUIDATA)
  • 1.
  • 1.
  • 1.
% --- Executes on button press in lap_button2.
  • 1.
function lap_button2_Callback(hObject, eventdata, handles)
  • 1.
axes(handles.axes4);
  • 1.
cla;
  • 1.
axes(handles.axes5);
  • 1.
cla;
  • 1.
axes(handles.axes6);
  • 1.
cla;
  • 1.
axes(handles.axes7);
  • 1.
cla;
  • 1.
%lap
  • 1.
load image.mat
  • 1.
NbColors=255;
  • 1.
map=gray(NbColors);
  • 1.
axes(handles.axes4);
  • 1.
image(lp0h);
  • 1.
colormap(map);
  • 1.
axes(handles.axes5);
  • 1.
image(lp1h);
  • 1.
colormap(map);
  • 1.
axes(handles.axes6);
  • 1.
image(lp2h);
  • 1.
colormap(map);
  • 1.
axes(handles.axes7);
  • 1.
image(lp3h);
  • 1.
colormap(map);
  • 1.
% hObject   handle to lap_button2 (see GCBO)
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   structure with handles and user data (see GUIDATA)
  • 1.
  • 1.
  • 1.
% --- Executes on button press in fu_button.
  • 1.
function fu_button_Callback(hObject, eventdata, handles)
  • 1.
axes(handles.axes4);
  • 1.
cla;
  • 1.
axes(handles.axes5);
  • 1.
cla;
  • 1.
axes(handles.axes6);
  • 1.
cla;
  • 1.
axes(handles.axes7);
  • 1.
cla;
  • 1.
fusion
  • 1.
load image.mat
  • 1.
NbColors=255;
  • 1.
map=gray(NbColors);
  • 1.
axes(handles.axes4);
  • 1.
image(fu0);
  • 1.
colormap(map);
  • 1.
axes(handles.axes5);
  • 1.
image(fu1);
  • 1.
colormap(map);
  • 1.
axes(handles.axes6);
  • 1.
image(fu2);
  • 1.
colormap(map);
  • 1.
axes(handles.axes7);
  • 1.
image(fu3);
  • 1.
colormap(map);
  • 1.
  • 1.
% hObject   handle to fu_button (see GCBO)
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   structure with handles and user data (see GUIDATA)
  • 1.
  • 1.
  • 1.
% --- Executes on button press in refactory_button.
  • 1.
function refactory_button_Callback(hObject, eventdata, handles)
  • 1.
axes(handles.axes4);
  • 1.
cla;
  • 1.
axes(handles.axes5);
  • 1.
cla;
  • 1.
axes(handles.axes6);
  • 1.
cla;
  • 1.
axes(handles.axes7);
  • 1.
cla;
  • 1.
refactory
  • 1.
load image.mat
  • 1.
NbColors=255;
  • 1.
map=gray(NbColors);
  • 1.
axes(handles.axes4);
  • 1.
image(output);
  • 1.
colormap(map);
  • 1.
% hObject   handle to refactory_button (see GCBO)
  • 1.
% eventdata reserved - to be defined in a future version of MATLAB
  • 1.
% handles   structure with handles and user data (see GUIDATA)
  • 1.

3 仿真结果

【图像融合】基于像素点图像融合matlab代码_参考文献

4 参考文献

[1]李俊峰. 基于像素级的图像融合方法研究[D]. 南昌航空大学, 2008.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

【图像融合】基于像素点图像融合matlab代码_ide_02