一、简介
基于matlab小波技术进行图像融合,通过比较不同原图像小波变换子图各像素邻域间的清晰度指标,提取不同尺度的细节信息构建全景聚焦图像,以消除传统空域融合方法因采用单一融合尺度而产生的块效应现象,通过小波逆变换获得融合图像。实验结果表明,这,种基于区域清晰度的融合方法要优于其他常用算法,减少了人工融合痕迹,融合效果好。
二、部分源码
function pushbutton1_Callback(hObject, eventdata, handles)
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;
end
handles.file1 = fullfile(pathname, filename);
guidata(hObject, handles);
Img1 = imread(fullfile(pathname, filename));
axes(handles.axes1);
imshow(Img1, []);
function pushbutton2_Callback(hObject, eventdata, handles)
[filename, pathname] = uigetfile({'*.jpg;*.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);
guidata(hObject, handles);
Img2 = imread(fullfile(pathname, filename));
axes(handles.axes2);
imshow(Img2, []);
function pushbutton3_Callback(hObject, eventdata, handles)
if isempty(handles.file1)
msgbox('请载入图像1!', '提示信息', 'modal');
return;
end
if 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');
三、运行结果
四、matlab版本
MATLAB R2019a
五、学习与交流
文中不足之处请大家多多指教,学习与交流可以联系企鹅:3752243968
文中部分源码仅供参考,若需要全部代码可以私信(有偿)