haar小波_【图像处理】基于小波技术的图像融合

      传统的信号理论,是建立在Fourier分析基础上的,而Fourier变换作为一种全局性的变化,其有一定的局限性,如不具备局部化分析能力、不能分析非平稳信号等。在实际应用中人们开始对Fourier变换进行各种改进,以改善这种局限性,如STFT(短时傅立叶变换)。由于STFT采用的的滑动窗函数一经选定就固定不变,故决定了其时频分辨率固定不变,不具备自适应能力。

  小波分析很好的解决了这个问题。小波直接把傅里叶变换的基给换了——将无限长的三角函数基换成了有限长的会衰减的小波基。这样不仅能够获取频率,还可以定位到时间了。

  常见小波函数:Haar、Daubechies、Biorthogonal、Coiflets、Symlets、Morlet、Mexican Hat、Meyer、Gaus、Dmeyer、ReverseBior、Cgau、Cmor、Fbsp、Shan.

clc;clear all;x1 = imread('images\实验图像1\1.jpg');x2 = imread('images\实验图像1\2.jpg');M1 = double(x1) ;M2 = double(x2);zt = 2;wtype = 'haar';[c0, s0] = Wave_Decompose(M1, zt, wtype);[c1, s1] = Wave_Decompose(M2, zt, wtype);Coef_Fusion = Fuse_Process(c0, c1, s0, s1);Y = Wave_Reconstruct(Coef_Fusion, s0, wtype);I=im2uint8(mat2gray(Y));subplot(1,3,1);imshow(x1);title('左模糊');subplot(1,3,2);imshow(x2);title('右模糊');figure;imshow(I);title('基于小波变换的图像融合');
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 MainForm_OpeningFcn gets called.  An%      unrecognized property name or invalid value makes property application%      stop.  All inputs are passed to MainForm_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 MainForm% Last Modified by GUIDE v2.5 22-Dec-2013 09:58:50% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @MainForm_OpeningFcn, ...                   'gui_OutputFcn',  @MainForm_OutputFcn, ...                   'gui_LayoutFcn',  [] , ...                   'gui_Callback',   []);if nargin && ischar(varargin{1})    gui_State.gui_Callback = str2func(varargin{1});endif 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 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 MainFormhandles.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 structureguidata(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 structurevarargout{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)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;*.tif;*.png;*.gif', 'All Image Files';...          '*.*', 'All Files' }, '选择图像1', ...          fullfile(pwd, 'images\\实验图像1\\a.tif'));if isequal(filename, 0)    return;endhandles.file1 = fullfile(pathname, filename);guidata(hObject, handles);Img1 = imread(fullfile(pathname, filename));axes(handles.axes1); imshow(Img1, []);% --- 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, pathname] = uigetfile({'*.jpg;*.tif;*.png;*.gif', 'All Image Files';...          '*.*', 'All Files' }, '选择图像2', ...          fullfile(pwd, 'images\\实验图像1\\b.tif'));if isequal(filename, 0)    return;endhandles.file2 = fullfile(pathname, filename);guidata(hObject, handles);Img2 = imread(fullfile(pathname, filename));axes(handles.axes2);imshow(Img2, []);% --- Executes on button press in pushbutton3.function pushbutton3_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)if isempty(handles.file1)    msgbox('请载入图像1!', '提示信息', 'modal');    return;endif isempty(handles.file2)    msgbox('请载入图像2!', '提示信息', 'modal');    return;end[imA, map1] = imread(handles.file1);[imB, map2] = imread(handles.file2);M1 = double(imA) / 256;M2 = double(imB) / 256;zt = 2;wtype = 'haar';[c0, s0] = Wave_Decompose(M1, zt, wtype);[c1, s1] = Wave_Decompose(M2, zt, wtype);Coef_Fusion = Fuse_Process(c0, c1, s0, s1);Y = Wave_Reconstruct(Coef_Fusion, s0, wtype);handles.result = im2uint8(mat2gray(Y));guidata(hObject, handles);msgbox('小波融合处理完毕!', '提示信息', 'modal');% --- 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)if isempty(handles.result)    msgbox('请进行填充处理!', '提示信息', 'modal');    return;endaxes(handles.axes3); imshow(handles.result, []);
function [c, s] = Wave_Decompose(M, zt, wtype)if nargin < 3    wtype = 'haar';endif nargin < 2    zt = 2;end[c, s] = wavedec2(M, zt, wtype);
function Y = Wave_Reconstruct(Coef_Fusion, s, wtype)if nargin < 3    wtype = 'haar';endY = waverec2(Coef_Fusion, s, wtype);

e59ef6c76a3cd89b394483118e844e74.png

往期回顾>>>>>>

【模式识别】Matlab指纹识别【优化求解】A*算法解决三维路径规划问题  matlab自动识别银行卡号【优化求解】模拟退火遗传实现带时间窗的车辆路径规划问题【数学建模】Matlab实现SEIR模型【优化求解】基于NSGA-2的求解多目标柔性车间调度算法【优化求解】蚁群算法求最优值 分享到朋友圈集赞10个即可获取源码

cee4d114755d239020771092deb68b19.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
图 像 融 合 是一 种 重要的 增 强 图 像信 息的 技术方 法 , 如 何 对 同 一 目 标 的多 源 遥 感 图 像 数 据 进 行有效 的融 合 , 最 大 限 度 地利 用 多 源 遥 感 数据 中 的 有 用 信 息 , 提 高 系 统的 正 确 识 别 、 判 断 和 决 策 能力 , 这是 遥感 数 据融 合研 究 的重要 内容之 一 。 图 像 融 合 技 术 的 发 展 经 历了 3 个阶段 : ( l ) 简单 的 图 像 融 合方 法 , 如 R G B 假彩色 合 成 、 I H S 彩 色 变 换 、 P CA 主 分 量 变换 法 等 ; ( 2 ) 随 着 塔 式算 子的提 出 , 在融 合领域 也出现 了 一 些较为复杂 的 模 型 ; ( 3 ) 用 小波 变换 的多 尺 度分 析 替代塔 式 算 法 。 传 统的图 像 数 据 融 合 方法对 中 、 高 分辨率 的遥 感 图 像 的 数据 融 合 一 般 都 能 取 得 比 较理 想的 效 果 , 但 对 于 低 分 辨率 的 遥 感 图 像 数 据 融 合 效 果 并 不 明 显 。 具 有 “ 数学 显 微 镜 ” 之称 的 小波变换 同时 在 时 域 和 频 域 具有分 辨率 , 对 高 频 分 量 采 用 逐 渐 精 细的 时域或 空 域 步 长 , 可 以 聚 焦 到 分析 对 象 的 任 意细节 , 对 于 剧 烈 变化 的 边 缘 , 比 常 规 的 傅 里 叶 变换 具有更 好 的适 应性 。 由 于 小波变换具有 的 特 点 , 使 它 很快在 图 像 处理 中 得 到 广 泛的应 用 。 与 传 统的 数据 融 合方 法相 比 , 小波融 合 方 法 不 仅 能 够 针 对 输 人图 像 的 不 同 特 征 来 合 理选择小波 基 以 及小 波 变 换 的次 数 , 而 且在融 合 操 作 时 又 可 以 根 据 实 际 需 要 来引 人 双方的细节 信 息 。 从 而 表 现 出 更 强 的针对 性 和 实 用 性 , 融 合效 果更 好 。 另 外 , 从实施 过程 的 灵 活性 方 面 评 价 , IH S 彩色变换 只 能 而且 必须 同 时对 三 个波 段 进行融 合 操 作 , P C A 主 分 量变换 法 的 输 人 图 像 必 须有 三 个或 三 个 以 上 , 而 小 波方 法则 能够完成 对 单 一 波 段 或多 个波 段 的 融 合 运 算 , 对 于 单 个 黑 白 图 像 的 融 合 , 小波 方 法 更 是唯一的选 择 。 本 文 提出 了 一种基 于 小波变 换 的 融 合方 法 , 使 得融 合 图 像 在最 大 限 度 保 留 多波段光 谱 信 息 的 同时 , 提 高 了 清 晰 度 和空 间 分 辨 率 。 并 在 M A T L A B 环 境 下 对 该方 法 进行 了 实 例 分 析 , 从 图 像 清 晰度 、 信 息墒 、 信 噪 比 等 几 个 方 面 对结 果 做 了 深 人的 分 析 与 对 比 , 发现 融 合 后的 图 像 均 值 和 方 差 基 本 保持 不 变 , 图 像 信 噪 比 为 ZO db 左右 , 说 明 融 合 后 的 图 像 基 本保持 了 原 始 图 像 的光 谱 特 性 , 而 信 息 嫡 和 清 晰度 有 明 显 的 提高 。 因 此基 于 小 波 变换 的 M a l l a t 多分辨 率 分 析 可 有 效 地 用 于 低分 辨 率多光 谱 遥 感 图 像 的 数 据 融 合 , 融 合 后 的图 像 在 信 息 含量 、
### 回答1: 可以回答这个问题。基于小波图像融合是一种常用的图像处理技术,利用小波变换对两张或多张图像进行分解,然后对其低频和高频系数进行融合,最后重构出一张新的图像。在MATLAB中,可以使用Wavelet Toolbox中的函数实现基于小波图像融合。 ### 回答2: 基于小波图像融合是一种常用的图像处理方法,它可以将不同来源的图像融合成一幅更具有信息丰富性和视觉效果的图像。在Matlab中,我们可以使用小波变换包进行图像的小波变换和融合。 首先,我们需要将需要融合的两幅图像进行小波变换。小波变换可以将图像分解成不同尺度和不同方向的频带。通过对图像的不同频带进行加权融合,可以根据图像特点进行选择,以达到更好的融合效果。 在Matlab中,可以使用`wavedec2`函数对图像进行小波变换。这个函数可以将图像分解成多个尺度和方向的频带系数。然后,我们可以根据需要选择进行融合的频带系数。一般来说,低频部分包含了图像的大致结构,可以直接保留;而高频部分包含了图像的细节信息,可以通过加权融合的方式进行融合。 在融合过程中,可以使用简单的加权平均法或者更复杂的融合算法,如拉普拉斯金字塔融合法。加权平均法即直接对频带系数进行加权平均,然后通过逆小波变换得到融合后的图像。而拉普拉斯金字塔融合法则是将两幅图像的低频部分进行加权平均,高频部分则选择相应图像中较大的频带系数进行融合,然后通过逆小波变换得到融合后的图像。 总之,基于小波图像融合是一种常用的图像处理方法,利用小波变换可以将图像分解成不同频带,然后通过加权融合的方式得到更具有信息丰富性和视觉效果的融合图像。在Matlab中,可以利用小波变换包进行图像的小波变换和融合。 ### 回答3: 基于小波图像融合是一种常见的图像处理方法,可通过对两幅不同源的图像进行小波变换,并结合小波系数的信息来生成一幅融合图像。 在Matlab中,可以利用小波变换工具箱中的函数来实现基于小波图像融合。首先,需要读取两幅待融合的图像,并将其转换为灰度图像。然后,通过调用Matlab的小波变换函数,如wavedec2()来对两幅图像进行小波分解,得到各个尺度的小波系数。 接下来,可以选择合适的融合规则来实现图像融合。常见的融合规则有最大值选择、平均值选择、最小值选择等。例如,可以对每个尺度的小波系数进行像素级的最大值选择,即在相同位置处选择小波系数较大的值作为融合结果的对应系数。 最后,可以利用小波逆变换函数,如waverec2(),将得到的融合小波系数进行逆变换,从而得到最终的融合图像。 在进行基于小波图像融合时,还可以选择不同的小波基函数和分解层数。常用的小波基函数有Haar、Daubechies等,分解层数决定了图像在不同尺度的细节信息。 总之,基于小波图像融合是一种常用的图像处理方法,在Matlab中可以借助小波变换工具箱中的函数来实现。通过对两幅图像进行小波变换和融合规则的选择,可以得到一幅融合图像,其中保留了源图像的重要信息,同时具有更好的视觉效果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值