【图像融合】基于拉普拉斯金字塔+小波变换+NSCT图像融合matlab源码含GUI

一、简介

1974年,法国工程师J.Morlet首先提出小波变换的概念,1986年著名数学家Y.Meyer偶然构造出一个真正的小波基,并与S.Mallat合作建立了构造小波基的多尺度分析之后,小波分析才开始蓬勃发展起来。小波分析的应用领域十分广泛,在数学方面,它已用于数值分析、构造快速数值方法、曲线曲面构造、微分方程求解、控制论等。在信号分析方面的滤波、去噪声、压缩、传递等。在图像处理方面的图像压缩、分类、识别与诊断,去噪声等。本章将着重阐述小波在图像中的应用分析。\ 1 小波变换原理\ 小波分析是一个比较难的分支,用户采用小波变换,可以实现图像压缩,振动信号的分解与重构等,因此在实际工程上应用较广泛。小波分析与Fourier变换相比,小波变换是空间域和频率域的局部变换,因而能有效地从信号中提取信息。小波变换通过伸缩和平移等基本运算,实现对信号的多尺度分解与重构,从而很大程度上解决了Fourier变换带来的很多难题。\ 小波分析作一个新的数学分支,它是泛函分析、Fourier分析、数值分析的完美结晶;小波分析也是一种“时间—尺度”分析和多分辨分析的新技术,它在信号分析、语音合成、图像压缩与识别、大气与海洋波分析等方面的研究,都有广泛的应用。\ (1)小波分析用于信号与图像压缩。小波压缩的特点是压缩比高,压缩速度快,压缩后能保持信号与图像的特征不变,且在传递中能够抗干扰。基于小波分析的压缩方法很多,具体有小波压缩,小波包压缩,小波变换向量压缩等。\ (2)小波也可以用于信号的滤波去噪、信号的时频分析、信噪分离与提取弱信号、求分形指数、信号的识别与诊断以及多尺度边缘检测等。\ (3)小波分析在工程技术等方面的应用概括的包括计算机视觉、曲线设计、湍流、远程宇宙的研究与生物医学方面。\ 2 多尺度分析\ 在这里插入图片描述\ 3 图像的分解和量化\ 在这里插入图片描述\ 4 图像压缩编码\ 在这里插入图片描述\ 5 图像编码评价\ 在这里插入图片描述

二、源代码

``` function varargout = MainForm(varargin) % MAINFORM MATLAB code for MainForm.fig % MAINFORM, by itself, creates a new MAINFORM or raises the existing % singleton. % % H = MAINFORM returns the handle to a new MAINFORM or the handle to % the existing singleton. % % MAINFORM('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in MAINFORM.M with the given input arguments. % % MAINFORM('Property','Value',...) creates a new MAINFORM or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before MainFormOpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to MainFormOpeningFcn 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 MainForm

% Last Modified by GUIDE v2.5 01-May-2021 22:52:25

% Begin initialization code - DO NOT EDIT guiSingleton = 1; guiState = struct('guiName', mfilename, ... 'guiSingleton', guiSingleton, ... 'guiOpeningFcn', @MainFormOpeningFcn, ... 'guiOutputFcn', @MainFormOutputFcn, ... 'guiLayoutFcn', [] , ... 'guiCallback', []); if nargin && ischar(varargin{1}) guiState.gui_Callback = str2func(varargin{1}); end

if nargout [varargout{1:nargout}] = guimainfcn(guiState, varargin{:}); else guimainfcn(guiState, varargin{:}); end % End initialization code - DO NOT EDIT

% --- Executes just before MainForm is made visible. function MainForm_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 MainForm (see VARARGIN)

% Choose default command line output for MainForm handles.output = hObject; clc; axes(handles.axes1); cla reset; box on; set(gca, 'XTickLabel', '', 'YTickLabel', ''); axes(handles.axes2); cla reset; box on; set(gca, 'XTickLabel', '', 'YTickLabel', ''); axes(handles.axes3); cla reset; box on; set(gca, 'XTickLabel', '', 'YTickLabel', '');

% Update handles structure guidata(hObject, handles);

% UIWAIT makes MainForm wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line. function varargout = MainForm_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 pushbutton1Callback(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) clc; axes(handles.axes1); cla reset; box on; set(gca, 'XTickLabel', '', 'YTickLabel', ''); axes(handles.axes2); cla reset; box on; set(gca, 'XTickLabel', '', 'YTickLabel', ''); axes(handles.axes3); cla reset; box on; set(gca, 'XTickLabel', '', 'YTickLabel', ''); handles.file1 = []; handles.file2 = []; handles.result = []; [filename, pathname] = uigetfile({'*.jpg;*.bmp;*.tif;*.png;*.gif', 'All Image Files';... '*.*', 'All Files' }, '选择图像1', ... fullfile(pwd, 'images\实验图像1\a.tif')); if isequal(filename, 0) return; end handles.file1 = fullfile(pathname, filename); Img1=imread(fullfile(pathname, filename)); % I=rgb2gray(Img); % Img1 = imresize(I,[240,320]); axes(handles.axes1); imshow(Img1, []); handles.Img1 =Img1 ; guidata(hObject, handles); % --- Executes on button press in pushbutton2. function pushbutton2Callback(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, pathname] = uigetfile({'.jpg;.bmp;.tif;.png;.gif', 'All Image Files';... '.*', 'All Files' }, '选择图像2', ... fullfile(pwd, 'images\实验图像1\b.tif')); if isequal(filename, 0) return; end handles.file2 = fullfile(pathname, filename);

Img2 =imread(fullfile(pathname, filename)); axes(handles.axes2); imshow(Img2, []); handles.Img2 =Img2 ; guidata(hObject, handles); % --- Executes on button press in pushbutton3. function pushbutton3Callback(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) %% 小波变换算法 imA = handles.Img1; imB = handles.Img2; M1 = double(imA) / 256; M2 = double(imB) / 256; zt = 2; wtype = 'haar'; [c0, s0] = WaveDecompose(M1, zt, wtype); [c1, s1] = WaveDecompose(M2, zt, wtype); CoefFusion = FuseProcess(c0, c1, s0, s1); Y = WaveReconstruct(CoefFusion, s0, wtype); handles.result = im2uint8(mat2gray(Y)); guidata(hObject, handles); msgbox('小波融合处理完毕!', '提示信息', 'modal'); % if isempty(handles.result) % msgbox('请进行填充处理!', '提示信息', 'modal'); % return; % end axes(handles.axes3); imshow(handles.result, []); title('小波变换融合处理结果') % --- Executes on button press in pushbutton4. function pushbutton4Callback(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) %% 拉普拉斯金字塔算法 addpath('./拉普拉斯金字塔算法图像融合') imA = handles.Img1; imB = handles.Img2; % im1 = double(imA) / 256; % im2= double(imB) / 256; im1 = double(imA); im2 = double(imB); %% %拉普拉斯滤波器 w = [1 4 6 4 1; 4 16 24 16 4; 6 24 36 24 6; 4 16 24 16 4; 1 4 6 4 1]/256; G = cell(1,5); H = cell(1,5); I = cell(1,5); G{1} = im1;%第一层为原图像 H{1} = im2; function Y = WaveReconstruct(CoefFusion, s, wtype)

if nargin < 3

end

Y = waverec2(CoefFusion, s, wtype); KK = size(c1); CoefFusion = zeros(1, KK(2)); Coef_Fusion(1:s1(1,1)s1(1,2)) = (c0(1:s1(1,1)s1(1,2))+c1(1:s1(1,1)s1(1,2)))/2; MM1 = c0(s1(1,1)s1(1,2)+1:KK(2)); MM2 = c1(s1(1,1)s1(1,2)+1:KK(2)); mm = (abs(MM1)) > (abs(MM2)); Y = (mm.MM1) + ((~mm).*MM2); ```

三、运行结果

在这里插入图片描述\ 在这里插入图片描述\ 在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Matlab科研辅导帮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值