1 简介
在图像处理过程中,图像噪声对图像的后续处理和清晰度影响较大.因此,对图像的降噪至关重要.随着小波变换的不断优化,小波变换广泛应用在图像降噪方面.该文基于软阈值的小波图像增强方法,通过实验论述小波变换在图像去噪中的应用.


2 部分代码
function varargout = wavelet(varargin)% WAVELET MATLAB code for wavelet.fig% WAVELET, by itself, creates a new WAVELET or raises the existing% singleton*.%% H = WAVELET returns the handle to a new WAVELET or the handle to% the existing singleton*.%% WAVELET('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in WAVELET.M with the given input arguments.%% WAVELET('Property','Value',...) creates a new WAVELET or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before wavelet_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to wavelet_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 wavelet% Last Modified by GUIDE v2.5 10-Jan-2021 05:42:48% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @wavelet_OpeningFcn, ...'gui_OutputFcn', @wavelet_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{:});elsegui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before wavelet is made visible.function wavelet_OpeningFcn(hObject, eventdata, handles, varargin)%**********************************************************************%% 五、重构%**********************************************************************%CA_Temp = RanksInterpolation(newCA,'r',2);CH_Temp = RanksInterpolation(newCH,'r',2);CloumnTemp1 = RanksConv(CA_Temp,Lo_R,'c')+RanksConv(CH_Temp,Hi_R,'c');CV_Temp = RanksInterpolation(newCV,'r',2);CD_Temp = RanksInterpolation(newCD,'r',2);CloumnTemp2 = RanksConv(CV_Temp,Lo_R,'c')+RanksConv(CD_Temp,Hi_R,'c');CloumnTempA = RanksInterpolation(CloumnTemp1,'c',2);CloumnTempB = RanksInterpolation(CloumnTemp2,'c',2);RowTemp = RanksConv(CloumnTempA,Lo_R,'r')+RanksConv(CloumnTempB,Hi_R,'r');Image_R =wkeep(RowTemp,size(HANDDLE_IMAGE),'c'); %提取向量和矩阵的部分axes(handles.axes_worked);image (Image_R)setappdata(handles.figure_wavelet,'Image_R',Image_R);%HANDDLE_IMAGE = img_src; %为避免后续程序中误用X故用自定义变量替代%image(HANDDLE_IMAGE);% imshow(X); %用imread读入图片,并用imshow在axes_src上显示% WAVELET_NAME = 'sym8';%[Lo_D,Hi_D,Lo_R,Hi_R]=wfilters(WAVELET_NAME);%RowLo_DTemp = RanksSampling(RanksConv(HANDDLE_IMAGE,Lo_D,'r'),'c',2);%CA = RanksSampling(RanksConv(RowLo_DTemp,Lo_D,'c'),'r',2);%subplot(221);image(CA);colormap(map);title('Lo_D低通分解后的图像CA')%画出CA的图像% --- Executes on selection change in popupmenu1.function popupmenu1_Callback(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu1% --- Executes on selection change in wavelet_style.function wavelet_style_Callback(hObject, eventdata, handles)% hObject handle to wavelet_style (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = cellstr(get(hObject,'String')) returns wavelet_style contents as cell array% contents{get(hObject,'Value')} returns selected item from wavelet_styleWAVELET_NAME = 'haar';val = get(handles.wavelet_style,'Value'); %获取下拉框的值switch val %选择小波case 1WAVELET_NAME = 'haar'case 2WAVELET_NAME = 'db2';case 3WAVELET_NAME = 'db4';case 4WAVELET_NAME = 'db6';case 5WAVELET_NAME = 'db8';case 6WAVELET_NAME = 'db10';case 7WAVELET_NAME = 'sym2';case 8WAVELET_NAME = 'sym4';case 9WAVELET_NAME = 'sym6';case 10WAVELET_NAME = 'sym8';case 11WAVELET_NAME = 'sym10';case 12WAVELET_NAME = 'coif1';case 13WAVELET_NAME = 'coif3';case 14WAVELET_NAME = 'coif5';case 15WAVELET_NAME = 'dmey'case 16WAVELET_NAME = 'haar'endsetappdata(handles.figure_wavelet,'WAVELET_NAME',WAVELET_NAME);% --- Executes during object creation, after setting all properties.function wavelet_style_CreateFcn(hObject, eventdata, handles)% hObject handle to wavelet_style (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');end% --- Executes on selection change in filter_style.function filter_style_Callback(hObject, eventdata, handles)% hObject handle to filter_style (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = cellstr(get(hObject,'String')) returns filter_style contents as cell array% contents{get(hObject,'Value')} returns selected item from filter_styleFilter_style = get(handles.filter_style,'Value');setappdata(handles.figure_wavelet,'Filter_style',Filter_style);% --- Executes during object creation, after setting all properties.function filter_style_CreateFcn(hObject, eventdata, handles)% hObject handle to filter_style (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');end% --------------------------------------------------------------------function m_thanks_Callback(hObject, eventdata, handles)% hObject handle to m_thanks (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)h = thanks;% --------------------------------------------------------------------function m_about_Callback(hObject, eventdata, handles)% hObject handle to m_about (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)h = about;% --------------------------------------------------------------------function m_file_Callback(hObject, eventdata, handles)% hObject handle to m_file (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function m_file_open_Callback(hObject, eventdata, handles)% hObject handle to m_file_open (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( ...{'*.bmp;*,jpg;*.png;*.jpeg;*.tif','Image File(*.bmp,*.jpg,*.png,*jpeg,*.tif)';...'*.*', 'All File(*.*)'},...'Pick an image');axes(handles.axes_original); %用axes命令设定当前操作的坐标轴是axes_srcfpath = [pathname filename]; %将文件名和目录名组合成一个完整的路径img_src = imread(fpath);imshow(img_src); %用imread读入图片,并用imshow在axes_src上显示setappdata(handles.figure_wavelet,'img_src',img_src);% --------------------------------------------------------------------function m_file_save_Callback(hObject, eventdata, handles)% hObject handle to m_file_save (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)[filename,pathname]=uiputfile({'*.bmp','BMP files';'*.jpg;','JPG files'},'Pick an Image');if isequal(filename,0) || isequal(pathname,0)return; %如果点了“取消”elsefpath = fullfile(pathname,filename);endImage_R = getappdata(handles.figure_wavelet,'Image_R');imwrite(Image_R,fpath);% --------------------------------------------------------------------function m_file_exit_Callback(hObject, eventdata, handles)% hObject handle to m_file_exit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)close;
3 仿真结果

4 参考文献
[1]张俊, & 朱凯荣. (2011). 基于matlab软件的小波变换在图像去噪中的应用. 电脑知识与技术(9X), 1.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
本文探讨了小波变换在图像处理中的关键作用,特别是使用软阈值技术对图像噪声进行有效去除。基于MATLAB代码示例,详细介绍了如何利用不同小波基(如Haar, db2, db4等)进行图像增强处理的过程。通过实验验证了小波去噪在提升图像清晰度方面的效果。
1706

被折叠的 条评论
为什么被折叠?



